mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-09 21:19:38 +00:00
7042623: Regression: javac silently crash when attributing non-existent annotation
Reviewed-by: mcimadamore
This commit is contained in:
parent
0cd0c8c54f
commit
8df816992b
@ -2240,8 +2240,10 @@ public class Check {
|
||||
class AnnotationValidator extends TreeScanner {
|
||||
@Override
|
||||
public void visitAnnotation(JCAnnotation tree) {
|
||||
super.visitAnnotation(tree);
|
||||
validateAnnotation(tree);
|
||||
if (!tree.type.isErroneous()) {
|
||||
super.visitAnnotation(tree);
|
||||
validateAnnotation(tree);
|
||||
}
|
||||
}
|
||||
}
|
||||
tree.accept(new AnnotationValidator());
|
||||
@ -2383,8 +2385,6 @@ public class Check {
|
||||
/** Check an annotation value.
|
||||
*/
|
||||
public void validateAnnotation(JCAnnotation a) {
|
||||
if (a.type.isErroneous()) return;
|
||||
|
||||
// collect an inventory of the members (sorted alphabetically)
|
||||
Set<MethodSymbol> members = new TreeSet<MethodSymbol>(new Comparator<Symbol>() {
|
||||
public int compare(Symbol t, Symbol t1) {
|
||||
|
||||
12
langtools/test/tools/javac/T7042623.java
Normal file
12
langtools/test/tools/javac/T7042623.java
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 7042623
|
||||
* @summary Regression: javac silently crash when attributing non-existent annotation
|
||||
* @compile/fail/ref=T7042623.out -XDrawDiagnostics -XDdev T7042623.java
|
||||
*/
|
||||
|
||||
@interface Defined2 {}
|
||||
|
||||
@Undefined1(@Defined2)
|
||||
class Test1{}
|
||||
|
||||
2
langtools/test/tools/javac/T7042623.out
Normal file
2
langtools/test/tools/javac/T7042623.out
Normal file
@ -0,0 +1,2 @@
|
||||
T7042623.java:10:2: compiler.err.cant.resolve: kindname.class, Undefined1, ,
|
||||
1 error
|
||||
Loading…
x
Reference in New Issue
Block a user