mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-21 12:20:29 +00:00
8179187: Misleading compilation error on annotated fully-qualified classname
Reviewed-by: jlahoda, vromero
This commit is contained in:
parent
fa61282423
commit
d605b5709a
@ -5270,11 +5270,15 @@ public class Attr extends JCTree.Visitor {
|
||||
|
||||
public void visitAnnotatedType(JCAnnotatedType tree) {
|
||||
attribAnnotationTypes(tree.annotations, env);
|
||||
Type underlyingType = attribType(tree.underlyingType, env);
|
||||
Type annotatedType = underlyingType.preannotatedType();
|
||||
Type underlyingType = attribTree(tree.underlyingType, env, resultInfo);
|
||||
if (underlyingType.getTag() == PACKAGE) {
|
||||
result = tree.type = underlyingType;
|
||||
} else {
|
||||
Type annotatedType = underlyingType.preannotatedType();
|
||||
|
||||
annotate.annotateTypeSecondStage(tree, tree.annotations, annotatedType);
|
||||
result = tree.type = annotatedType;
|
||||
annotate.annotateTypeSecondStage(tree, tree.annotations, annotatedType);
|
||||
result = tree.type = annotatedType;
|
||||
}
|
||||
}
|
||||
|
||||
public void visitErroneous(JCErroneous tree) {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8026564 8043226 8334055
|
||||
* @bug 8026564 8043226 8334055 8179187
|
||||
* @summary The parts of a fully-qualified type can't be annotated.
|
||||
* @author Werner Dietl
|
||||
* @compile/fail/ref=CantAnnotatePackages.out -XDrawDiagnostics CantAnnotatePackages.java
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
CantAnnotatePackages.java:16:14: compiler.err.cant.resolve.location: kindname.class, java, , , (compiler.misc.location: kindname.class, CantAnnotatePackages, null)
|
||||
CantAnnotatePackages.java:17:9: compiler.err.cant.resolve.location: kindname.class, lang, , , (compiler.misc.location: kindname.package, java, null)
|
||||
CantAnnotatePackages.java:18:14: compiler.err.cant.resolve.location: kindname.class, lang, , , (compiler.misc.location: kindname.package, java, null)
|
||||
CantAnnotatePackages.java:14:18: compiler.err.type.annotation.inadmissible: (compiler.misc.type.annotation.1: @TA), java.lang, @TA java.lang.Object
|
||||
CantAnnotatePackages.java:16:14: compiler.err.type.annotation.inadmissible: (compiler.misc.type.annotation.1: @TA), java.lang, @TA java.lang.Object
|
||||
CantAnnotatePackages.java:17:9: compiler.err.type.annotation.inadmissible: (compiler.misc.type.annotation.1: @TA), java.lang, @TA java.lang.Object
|
||||
CantAnnotatePackages.java:18:14: compiler.err.type.annotation.inadmissible: (compiler.misc.type.annotation.1: @TA), java.lang, @TA java.lang.Object
|
||||
4 errors
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8006733 8006775 8043226 8334055
|
||||
* @bug 8006733 8006775 8043226 8334055 8179187
|
||||
* @summary Ensure behavior for nested types is correct.
|
||||
* @author Werner Dietl
|
||||
* @compile/fail/ref=CantAnnotateScoping.out -XDrawDiagnostics CantAnnotateScoping.java
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
CantAnnotateScoping.java:63:9: compiler.err.cant.resolve.location: kindname.class, lang, , , (compiler.misc.location: kindname.package, java, null)
|
||||
CantAnnotateScoping.java:68:9: compiler.err.cant.resolve.location: kindname.class, XXX, , , (compiler.misc.location: kindname.package, java, null)
|
||||
CantAnnotateScoping.java:71:9: compiler.err.cant.resolve.location: kindname.class, lang, , , (compiler.misc.location: kindname.package, java, null)
|
||||
CantAnnotateScoping.java:68:18: compiler.err.doesnt.exist: java.XXX
|
||||
CantAnnotateScoping.java:38:14: compiler.err.type.annotation.inadmissible: (compiler.misc.type.annotation.1: @TA), Test.Outer, @TA Test.Outer.SInner
|
||||
CantAnnotateScoping.java:51:18: compiler.err.type.annotation.inadmissible: (compiler.misc.type.annotation.1: @TA), java.lang, @TA java.lang.Object
|
||||
CantAnnotateScoping.java:60:37: compiler.err.type.annotation.inadmissible: (compiler.misc.type.annotation: @TA,@TA2), java.lang, @DTA @TA @TA2 java.lang.Object
|
||||
CantAnnotateScoping.java:40:14: compiler.err.type.annotation.inadmissible: (compiler.misc.type.annotation.1: @TA), Test.Outer, @TA Test.Outer.SInner
|
||||
CantAnnotateScoping.java:63:11: compiler.err.annotation.type.not.applicable.to.type: DA
|
||||
CantAnnotateScoping.java:68:11: compiler.err.annotation.type.not.applicable.to.type: DA
|
||||
CantAnnotateScoping.java:71:9: compiler.err.type.annotation.inadmissible: (compiler.misc.type.annotation.1: @TA), java.lang, @TA java.lang.Object
|
||||
CantAnnotateScoping.java:44:34: compiler.err.type.annotation.inadmissible: (compiler.misc.type.annotation: @TA,@TA2), Test.Outer, @TA @TA2 Test.Outer.SInner
|
||||
CantAnnotateScoping.java:44:25: compiler.err.annotation.type.not.applicable.to.type: DA
|
||||
CantAnnotateScoping.java:48:38: compiler.err.type.annotation.inadmissible: (compiler.misc.type.annotation.1: @TA), Test.Outer, @TA Test.Outer.SInner
|
||||
CantAnnotateScoping.java:48:34: compiler.err.annotation.type.not.applicable.to.type: DA
|
||||
11 errors
|
||||
12 errors
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user