This is the mail archive of the
mailing list for the GCC project.
RFC: fix PR 28892
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Cc: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: 29 Aug 2006 16:16:53 -0600
- Subject: RFC: fix PR 28892
- Reply-to: tromey at redhat dot com
PR 28892 involves compiling bytecode which has been run through
retroweaver. Apparently retroweaver will emit bytecode that
initializes static final variables in methods other than <clinit>.
This particular set of constraints doesn't appear to be checked by the
JDK, meaning that this is bytecode which JDK users can run but which
we will reject.
I fixed this by removing the checks. Any comments (Andrew?) before I
check this in?
This passes our test suite. It also lets me compiling the test jars
from the PR.
from Tom Tromey <firstname.lastname@example.org>
* expr.c (expand_java_field_op): No error for assignments not in
class initializer or constructor.
--- java/expr.c (revision 116140)
+++ java/expr.c (working copy)
@@ -2846,21 +2846,10 @@
if (DECL_CONTEXT (field_decl) != current_class)
error ("assignment to final field %q+D not in field's class",
- 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",
- 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",
+ /* 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))