Community
Participate
Working Groups
Build ID: M20080911-1700 Steps To Reproduce: === test/A.java == package test; import static test.A.B.bar; import other.C; public class A { public void foo() { bar(); } public static class B extends C { public static void bar() { } } } === other/C.java == package other; public class C { } More information: Eclipse compiles this code whereas Sun's javac (1.6.0_11) fails like so: test\A.java:12: cannot find symbol symbol : class C location: class test.A public static class B extends C { ^ 1 error In both cases the code compiles fine if the order of the two import statements is switched! Arguably Eclipse is being smarter here, so it may be worth checking if the language specification has anything to say on this matter.
Replacing "B extends C" with "B extends other.C" also makes javac happy.
Cannot find anything in the spec that says static import statements are order dependent. I suggest you enter a bug against javac.
Looks like this bug is indeed a problem with Sun's javac (and has been known for 3 years now!): http://bugs.sun.com/view_bug.do?bug_id=6391197
Verified for 3.5M6