Community
Participate
Working Groups
Build ID: I20080617-2000 Steps To Reproduce: 1. Create a new Java file, named test/Outer.java with the following content: package test; import static test.Outer.Inner.*; public class Outer { int i = VALUE; int i2 = Inner.VALUE; static class Inner { private static final int VALUE = 0; } } 2. Notice that the code compiles cleanly. 3. Change the static import statement to: import static test.Outer.Inner.VALUE; 4. Notice that we get two errors: Description Resource Path Location Type The field Outer.Inner.test.Outer.Inner.VALUE is not visible Outer.java Test/src/test line 3 Java Problem Description Resource Path Location Type VALUE cannot be resolved Outer.java Test/src/test line 7 Java Problem More information:
This feels the right behavior to me, since a private member is not visible inside entire compilation unit, but rather in toplevel type declaration it occurs into. So essentially, the single type static import is doomed, as VALUE is not accessible outside Outer. But the on demand static import is working fine, since VALUE is only referenced from a valid context. Interestingly, javac seems to also reject the on demand static import case, which I suspect is wrong.
Added StaticImportTest#test073-074. Marking as Invalid, since this is working as specified.
Verified for 3.5M4