JDK-7177814 : Static import to local nested class fails
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_7
  • CPU: x86
  • Submitted: 2012-06-18
  • Updated: 2012-09-06
  • Resolved: 2012-06-20
Related Reports
Duplicate :  
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