Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6724345

incorrect method resolution for enum classes entered as source files

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 7
    • 6, 6u20, 6u25
    • tools
    • b39
    • x86
    • linux, windows_xp
    • Not verified

        FULL PRODUCT VERSION :
        java version "1.6.0_10-rc"
        Java(TM) SE Runtime Environment (build 1.6.0_10-rc-b27)
        Java HotSpot(TM) Client VM (build 11.0-b14, mixed mode)


        A DESCRIPTION OF THE PROBLEM :
        Compilation of the enclosed program is very sensitive to the order in which the source files are presented.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Unpack the sources and try

        javac U.java

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Compiles successfully
        ACTUAL -
        Fails to compile

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        U.java:5: cannot find symbol
        symbol : method i()
        location: class E
        E.V.i();
                   ^
        1 error


        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        ==> I.java <==
        interface I {
         void i();
        }

        ==> E.java <==
        enum E implements I {
         V { public void i() { } };
         // public abstract void i();
        }

        ==> U.java <==
        class U {
         {
           I i = E.V;
           i.i();
           E.V.i();
         }
        }
        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        running 'javac E.java && javac U.java' succeeds.

        Uncommenting line 3 of E.java also works around the problem.

              mcimadamore Maurizio Cimadamore
              ryeung Roger Yeung (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: