expr.c (expand_java_field_op): Assigning to a final field outside an initializer...
authorPer Bothner <per@bothner.com>
Sun, 14 Jan 2001 17:37:09 +0000 (09:37 -0800)
committerPer Bothner <bothner@gcc.gnu.org>
Sun, 14 Jan 2001 17:37:09 +0000 (09:37 -0800)
* expr.c (expand_java_field_op):  Assigning to a final field outside
an initializer does not violate JVM spec, so should be warning, not
error.  (Sun's verifier does not complain - though MicroSoft's does.)

From-SVN: r39013

gcc/java/ChangeLog
gcc/java/expr.c

index 71516457aca7701f484e154b3babc3504e030c55..0907e731642e162cfa5e670b8bb7f7a4e4d7d7d0 100644 (file)
@@ -1,3 +1,9 @@
+2001-01-13  Per Bothner  <per@bothner.com>
+
+       * expr.c (expand_java_field_op):  Assigning to a final field outside
+       an initializer does not violate JVM spec, so should be warning, not
+       error.  (Sun's verifier does not complain - though MicroSoft's does.)
+       
 2001-01-12  Joseph S. Myers  <jsm28@cam.ac.uk>
 
        * gjavah.c (version), jcf-dump.c (version): Update copyright year
index 4ad903ee70ecc09973ba412c6461c6d2b23e0c86..ddfc473f79778ecdcd79678b848f6696387802ca 100644 (file)
@@ -2215,7 +2215,7 @@ expand_java_field_op (is_static, is_putting, field_ref_index)
          else if (FIELD_STATIC (field_decl))
            {
              if (!DECL_CLINIT_P (current_function_decl))
-               error_with_decl (field_decl, 
+               warning_with_decl (field_decl, 
              "assignment to final static field `%s' not in class initializer");
            }
          else
@@ -2223,7 +2223,7 @@ expand_java_field_op (is_static, is_putting, field_ref_index)
              tree cfndecl_name = DECL_NAME (current_function_decl);
              if (! DECL_CONSTRUCTOR_P (current_function_decl)
                  && !ID_FINIT_P (cfndecl_name))
-               error_with_decl (field_decl, "assignment to final field `%s' not in constructor");
+               warning_with_decl (field_decl, "assignment to final field `%s' not in constructor");
            }
        }
       expand_assignment (field_ref, new_value, 0, 0);