Community
Participate
Working Groups
Using HEAD, compiler does not report any error on following invalid static import: import static java.lang.System; public class X { public static void main (String[] args) { out.println("SUCCESS"); } } Valid static import are only: import static <type ref>.*; import static <type ref>.<identifier>; Sun JDK 1.5 javac reports following errors: X.java:1: cannot find symbol symbol : class lang location: package java import static java.lang.System; ^ X.java:1: static import only from classes and interfaces import static java.lang.System; ^ X.java:4: cannot find symbol symbol : variable out location: class X out.println("SUCCESS"); ^ 3 errors
Oooops, in fact compiler reports errors on comment 0 syntax: - unused import - out unresolved Syntax which does not provide any error is: import static java.lang.System; public class X { public static void main (String[] args) { System.out.println("SUCCESS"); } }
On comment 1 syntax, javac reports following errors: X.java:1: cannot find symbol symbol : class lang location: package java import static java.lang.System; ^ X.java:1: static import only from classes and interfaces import static java.lang.System; ^ 2 errors
Fixed. Added StaticImportTest.test008().
Verified for 3.1M3 with build I20041102