* expr.c (expand_java_field_op): No error for assignments not in
class initializer or constructor.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116889
138bc75d-0d04-0410-961f-
82ee72b054a4
+2006-09-12 Tom Tromey <tromey@redhat.com>
+
+ PR java/28892:
+ * expr.c (expand_java_field_op): No error for assignments not in
+ class initializer or constructor.
+
2006-08-22 Andrew Haley <aph@redhat.com>
* decl.c (java_add_stmt): Give the statement list a type.
2006-08-22 Andrew Haley <aph@redhat.com>
* decl.c (java_add_stmt): Give the statement list a type.
if (DECL_CONTEXT (field_decl) != current_class)
error ("assignment to final field %q+D not in field's class",
field_decl);
if (DECL_CONTEXT (field_decl) != current_class)
error ("assignment to final field %q+D not in field's class",
field_decl);
- else if (FIELD_STATIC (field_decl))
- {
- if (!DECL_CLINIT_P (current_function_decl))
- warning (0, "assignment to final static field %q+D not in "
- "class initializer",
- field_decl);
- }
- else
- {
- tree cfndecl_name = DECL_NAME (current_function_decl);
- if (! DECL_CONSTRUCTOR_P (current_function_decl)
- && !ID_FINIT_P (cfndecl_name))
- warning (0, "assignment to final field %q+D not in constructor",
- field_decl);
- }
+ /* We used to check for assignments to final fields not
+ occurring in the class initializer or in a constructor
+ here. However, this constraint doesn't seem to be
+ enforced by the JVM. */
}
if (TREE_THIS_VOLATILE (field_decl))
}
if (TREE_THIS_VOLATILE (field_decl))