JDK-7177813 : Static import to local nested class fails
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_7
  • CPU: x86
  • Submitted: 2012-06-18
  • Updated: 2017-08-30
  • Resolved: 2014-12-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b42Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
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