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

Static import to local nested class fails

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b42
    • CPU:
      x86
    • OS:
      windows_7
    • Verification:
      Verified

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "1.7.0_05"
        Java(TM) SE Runtime Environment (build 1.7.0_05-b05)
        Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows [Version 6.1.7601]

        A DESCRIPTION OF THE PROBLEM :
        static imports to nested classes in the same compilation unit fail in certain situations.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        >javac pack\C.java pack\sub\I.java



        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Compiler should show no error
        ACTUAL -
        pack\C.java:13: error: cannot find symbol

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        File pack/C.java:
        ----snip----
        package pack;

        import static pack.C.E.A;
        import pack.sub.I;

        public class C
        {
            public void bla ()
            {
                System.out.println(A);
            }
            
            public static enum E implements I
            {
                A
            }
        }
        ----snip----
        File pack/sub/I.java
        ----snip----
        package pack.sub;
        public interface I
        {
        }

        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        swap import statements in C.java

        remove import pack.sub.I, use FQN for definition of E


        SUPPORT :
        YES

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  jlahoda Jan Lahoda
                  Reporter:
                  webbuggrp Webbug Group
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: