-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
9
The following invalid program crashes javac. The first annotation appears to be interfering with attribution of the second annotation, which causes an assertion to fail.
It affects 9-ea+165, and reproduces as far back as 1.6.0-b105 although the crash it produces in earlier releases is different.
===
public class T {
@interface A { Class<?> c() default Object.class; }
@interface B {}
@A(c = new Object() {}) @B int x;
}
===
$ javac -fullversion T.java
javac full version "9-ea+165"
java.lang.AssertionError
at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
at jdk.compiler/com.sun.tools.javac.util.Assert.checkNonNull(Assert.java:62)
at jdk.compiler/com.sun.tools.javac.comp.Check.validateTypeAnnotation(Check.java:2858)
at jdk.compiler/com.sun.tools.javac.comp.Attr$TypeAnnotationsValidator.visitAnnotation(Attr.java:4683)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCAnnotation.accept(JCTree.java:2561)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitModifiers(TreeScanner.java:353)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCModifiers.accept(JCTree.java:2590)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at jdk.compiler/com.sun.tools.javac.comp.Attr$TypeAnnotationsValidator.visitVarDef(Attr.java:4724)
It affects 9-ea+165, and reproduces as far back as 1.6.0-b105 although the crash it produces in earlier releases is different.
===
public class T {
@interface A { Class<?> c() default Object.class; }
@interface B {}
@A(c = new Object() {}) @B int x;
}
===
$ javac -fullversion T.java
javac full version "9-ea+165"
java.lang.AssertionError
at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
at jdk.compiler/com.sun.tools.javac.util.Assert.checkNonNull(Assert.java:62)
at jdk.compiler/com.sun.tools.javac.comp.Check.validateTypeAnnotation(Check.java:2858)
at jdk.compiler/com.sun.tools.javac.comp.Attr$TypeAnnotationsValidator.visitAnnotation(Attr.java:4683)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCAnnotation.accept(JCTree.java:2561)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitModifiers(TreeScanner.java:353)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCModifiers.accept(JCTree.java:2590)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at jdk.compiler/com.sun.tools.javac.comp.Attr$TypeAnnotationsValidator.visitVarDef(Attr.java:4724)