Compiling this test code crashes:
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.*;
public class test {
public static void main(String argv[]) {
new test().foo();
}
public void foo() {
Class c = int @A [] .class;
// System.out.println(c);
}
}
@Target(TYPE_USE) @interface A {}
An exception has occurred in the compiler (1.9.0-ea). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.AssertionError
at com.sun.tools.javac.util.Assert.error(Assert.java:126)
at com.sun.tools.javac.util.Assert.checkNonNull(Assert.java:61)
at com.sun.tools.javac.comp.Attr.fromAnnotations(Attr.java:4315)
at com.sun.tools.javac.comp.Attr.access$500(Attr.java:75)
at com.sun.tools.javac.comp.Attr$12.run(Attr.java:4299)
at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:163)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4365)
at com.sun.tools.javac.comp.Attr.attrib(Attr.java:4341)
at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1242)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:887)
at com.sun.tools.javac.main.Main.compile(Main.java:541)
at com.sun.tools.javac.main.Main.compile(Main.java:392)
at com.sun.tools.javac.main.Main.compile(Main.java:381)
at com.sun.tools.javac.main.Main.compile(Main.java:372)
at com.sun.tools.javac.Main.compile(Main.java:56)
at com.sun.tools.javac.Main.main(Main.java:42)
If the println is uncommented, this get an "scoping construct cannot be annotated with type-use annotation" error (why isn't it a compiler.err.no.annotations.on.dot.class error?).