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

Static import to local nested class fails

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P4
    • None
    • 7
    • tools
    • x86
    • windows_7

    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

              Unassigned Unassigned
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: