Community
Participate
Working Groups
Using latest, @interface I { int id default 0; } @I() public class X { public static void main(String[] s) { System.out.println(X.class.getAnnotation(I.class)); } } It reports: ---------- 1. ERROR in C:\tests_sources\X.java (at line 2) int id default 0; ^^^^^^^ Syntax error on token "default", = expected ---------- 2. ERROR in C:\tests_sources\X.java (at line 5) @I() public class X { ^ Type mismatch: cannot convert from I to Annotation ---------- 3. ERROR in C:\tests_sources\X.java (at line 7) System.out.println(X.class.getAnnotation(I.class)); ^^^^^^^^^^^^^ Bound mismatch: The generic method getAnnotation(Class<A>) of type Class<T> is not applicable for the arguments (Class<I>) since the type I is not a valid substitute for the bounded parameter <A extends Annotation> ---------- 3 problems (3 errors) I would expect only the first problem.
Fixed with recovery in annotation types. Fixed and released in HEAD. Regression test added in AnnotationTest.test098.