Description
Test:
tools/javac/annotations/typeAnnotations/failures/T8009360.java
type-annotation on member of anonymous class results in AssertionError.
class Test1<T> {
Object mtest( Test1<T> t){ return null; }
public void test() {
mtest( new Test1<T>() {
@A String odata1 = "test";
});
}
}
@Target({TYPE_USE,FIELD}) @interface A { }
/*
An exception has occurred in the compiler (1.8.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: Can't annotate already annotated type: (@A ::
java.lang.String); adding: @A,@B
at com.sun.tools.javac.util.Assert.error(Assert.java:133)
at com.sun.tools.javac.util.Assert.check(Assert.java:94)
at
com.sun.tools.javac.code.Type$AnnotatedType.<init>(Type.java:1590)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions$1.visitAnnotatedType(TypeAnnotations.java:513)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions$1.visitAnnotatedType(TypeAnnotations.java:492)
at
com.sun.tools.javac.code.Type$AnnotatedType.accept(Type.java:1627)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.typeWithAnnotations(TypeAnnotations.java:572)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.typeWithAnnotations(TypeAnnotations.java:456)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.separateAnnotationsKinds(TypeAnnotations.java:286)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitVarDef(TypeAnnotations.java:1033)
at
com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:828)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:232)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitClassDef(TypeAnnotations.java:943)
at
com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:686)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:232)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitNewClass(TypeAnnotations.java:1124)
at
com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1491)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:232)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
at
com.sun.tools.javac.tree.TreeScanner.visitApply(TreeScanner.java:199)
at
com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1440)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:232)
at
com.sun.tools.javac.tree.TreeScanner.visitExec(TreeScanner.java:174)
at
com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1271)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:232)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitBlock(TypeAnnotations.java:1072)
at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:884)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:232)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitMethodDef(TypeAnnotations.java:1010)
at
com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:771)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:232)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitClassDef(TypeAnnotations.java:943)
at
com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:686)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:232)
at
com.sun.tools.javac.code.TypeAnnotations.organizeTypeAnnotationsBodies(TypeAnnotations.java:105)
at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4161)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4039)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:3973)
at com.sun.tools.javac.comp.Attr.attrib(Attr.java:3947)
at
com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1256)
at
com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:909)
at
com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:868)
at com.sun.tools.javac.main.Main.compile(Main.java:517)
at com.sun.tools.javac.main.Main.compile(Main.java:376)
at com.sun.tools.javac.main.Main.compile(Main.java:365)
at com.sun.tools.javac.main.Main.compile(Main.java:356)
at com.sun.tools.javac.Main.compile(Main.java:77)
at com.sun.tools.javac.Main.main(Main.java:62)
tools/javac/annotations/typeAnnotations/failures/T8009360.java
type-annotation on member of anonymous class results in AssertionError.
class Test1<T> {
Object mtest( Test1<T> t){ return null; }
public void test() {
mtest( new Test1<T>() {
@A String odata1 = "test";
});
}
}
@Target({TYPE_USE,FIELD}) @interface A { }
/*
An exception has occurred in the compiler (1.8.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: Can't annotate already annotated type: (@A ::
java.lang.String); adding: @A,@B
at com.sun.tools.javac.util.Assert.error(Assert.java:133)
at com.sun.tools.javac.util.Assert.check(Assert.java:94)
at
com.sun.tools.javac.code.Type$AnnotatedType.<init>(Type.java:1590)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions$1.visitAnnotatedType(TypeAnnotations.java:513)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions$1.visitAnnotatedType(TypeAnnotations.java:492)
at
com.sun.tools.javac.code.Type$AnnotatedType.accept(Type.java:1627)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.typeWithAnnotations(TypeAnnotations.java:572)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.typeWithAnnotations(TypeAnnotations.java:456)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.separateAnnotationsKinds(TypeAnnotations.java:286)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitVarDef(TypeAnnotations.java:1033)
at
com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:828)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:232)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitClassDef(TypeAnnotations.java:943)
at
com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:686)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:232)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitNewClass(TypeAnnotations.java:1124)
at
com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1491)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:232)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
at
com.sun.tools.javac.tree.TreeScanner.visitApply(TreeScanner.java:199)
at
com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1440)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:232)
at
com.sun.tools.javac.tree.TreeScanner.visitExec(TreeScanner.java:174)
at
com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1271)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:232)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitBlock(TypeAnnotations.java:1072)
at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:884)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:232)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitMethodDef(TypeAnnotations.java:1010)
at
com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:771)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:232)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.visitClassDef(TypeAnnotations.java:943)
at
com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:686)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at
com.sun.tools.javac.code.TypeAnnotations$TypeAnnotationPositions.scan(TypeAnnotations.java:232)
at
com.sun.tools.javac.code.TypeAnnotations.organizeTypeAnnotationsBodies(TypeAnnotations.java:105)
at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4161)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4039)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:3973)
at com.sun.tools.javac.comp.Attr.attrib(Attr.java:3947)
at
com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1256)
at
com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:909)
at
com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:868)
at com.sun.tools.javac.main.Main.compile(Main.java:517)
at com.sun.tools.javac.main.Main.compile(Main.java:376)
at com.sun.tools.javac.main.Main.compile(Main.java:365)
at com.sun.tools.javac.main.Main.compile(Main.java:356)
at com.sun.tools.javac.Main.compile(Main.java:77)
at com.sun.tools.javac.Main.main(Main.java:62)
Attachments
Issue Links
- relates to
-
JDK-8011722 [1.8] NPE when compiling throws clause with TYPE_USE annotated qualified type
-
- Closed
-