Community
Participate
Working Groups
Right now the following test case fails with a syntax error: public @interface X<T> { Zork foo(); } ---------- 1. ERROR in X.java (at line 1) public @interface X<T> { ^ Syntax error on token "X", { expected after this token ---------- 2. ERROR in X.java (at line 1) public @interface X<T> { ^ Syntax error, insert "}" to complete Block ---------- 3. ERROR in X.java (at line 1) public @interface X<T> { Zork foo(); ^^^^^^ The interface X cannot define an initializer ---------- 4. ERROR in X.java (at line 3) Zork foo(); ^^^^ Zork cannot be resolved to a type ---------- 4 problems (4 errors) we could change it to also report the error on Zork. ---------- 1. ERROR in D:\tests_sources\X.java (at line 1) public @interface X<T> { ^ Syntax error, annotation declaration cannot have type parameters ---------- 2. ERROR in D:\tests_sources\X.java (at line 3) Zork foo(); ^^^^ Zork cannot be resolved to a type ---------- 2 problems (2 errors) This is much more understandable for the user.
Created attachment 67090 [details] Proposed fix
Created attachment 67091 [details] Parser resources Unzip in the Parser folder.
The patch looks good.
Enum should also be improved. Updating title accordingly.
Released in HEAD. Added regression tests in org.eclipse.jdt.core.tests.compiler.regression.AnnotationTest#test227 and org.eclipse.jdt.core.tests.compiler.regression.EnumTest#test144. I also updated existing diet recovery test for the annotations. David, please review the changes.