--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Thu Nov 29 18:57:18 2018 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Fri Nov 30 10:37:48 2018 +0530
@@ -169,9 +169,12 @@
/**
* Determine whether an annotation is a declaration annotation,
- * a type annotation, or both.
+ * a type annotation, or both (or none, i.e a non-annotation masquerading as one).
*/
public AnnotationType annotationTargetType(Attribute.Compound a, Symbol s) {
+ if (!a.type.tsym.isAnnotationType()) {
+ return AnnotationType.NONE;
+ }
List<Attribute> targets = annotationTargets(a.type.tsym);
return (targets == null) ?
AnnotationType.DECLARATION :
@@ -319,6 +322,8 @@
onlyTypeAnnos.append(ta);
break;
}
+ case NONE: // Error signaled already, just drop the non-annotation.
+ break;
}
}