aboutsummaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2006-09-12 15:47:26 +0000
committerTom Tromey <tromey@gcc.gnu.org>2006-09-12 15:47:26 +0000
commit91da2e7c337d584339a6d5ee28ca6d7e30a2b3f4 (patch)
treecc2ad6b78cf647e45bcdb39f3ef14fe54574b716 /gcc/java
parent93c094b52446169562292970e81c963517b58b37 (diff)
downloadgcc-91da2e7c337d584339a6d5ee28ca6d7e30a2b3f4.zip
gcc-91da2e7c337d584339a6d5ee28ca6d7e30a2b3f4.tar.gz
gcc-91da2e7c337d584339a6d5ee28ca6d7e30a2b3f4.tar.bz2
re PR java/28892 (assignment to static field not in class initializer)
PR java/28892: * expr.c (expand_java_field_op): No error for assignments not in class initializer or constructor. From-SVN: r116889
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog6
-rw-r--r--gcc/java/expr.c19
2 files changed, 10 insertions, 15 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index cc34b73..e7508bf 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,9 @@
+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.
diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index a64bda8..b08d33e 100644
--- a/gcc/java/expr.c
+++ b/gcc/java/expr.c
@@ -2846,21 +2846,10 @@ expand_java_field_op (int is_static, int is_putting, int field_ref_index)
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))