This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PR java/25429: can't see private static final int CREATE = 1


Constant propagation is broken when importing into an inner class.
Fixed thusly.  Tested/bootstrapped.

class C
{
    private static final int CONST  = 0;
    class I {
        public void f () {
            switch(0) {
            case CONST:
            }
        }
    }
}

Andrew.



2005-12-13  Andrew Haley  <aph@redhat.com>

	PR java/25429
        * parse.y (resolve_expression_name): Don't generate accessor
        methods for initialized static final variables.

Index: java/parse.y
===================================================================
--- java/parse.y        (revision 108423)
+++ java/parse.y        (working copy)
@@ -9584,8 +9584,12 @@
 
              /* If we're processing an inner class and we're trying
                 to access a field belonging to an outer class, build
-                the access to the field.  */
-             if (nested_member_access_p (current_class, decl))
+                the access to the field.  
+                As usual, we have to treat initialized static final
+                variables as a special case.  */
+             if (nested_member_access_p (current_class, decl)
+                 && ! (JDECL_P (decl) && CLASS_FINAL_VARIABLE_P (decl)
+                       && DECL_INITIAL (decl) != NULL_TREE))
                {
                  if (!fs && CLASS_STATIC (TYPE_NAME (current_class)))
                    {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]