Community
Participate
Working Groups
build I20041201 + jdtcore head 1) create Test.java @interface MyAnn { String value1() default ""; String value2(); } class ZZZ {} public @MyAnn("","") class Test { } 2) compile The errors are the followings The public type MyAnn must be defined in its own file Syntax error, insert "}" to complete ClassBody Syntax error on token "}", delete this token Return type for the method is missing Syntax error, insert ";" to complete ConstructorDeclaration Syntax error, insert ")" to complete ConstructorDeclaration Syntax error, insert ")" to complete SingleMemberAnnotation Syntax error, insert "Identifier (" to complete ConstructorHeaderName Syntax error on token ",", / expected
The problem come from modifer. Parser#modiferSourceStart is not reinitialized when recovery restart. So when "@interface MyAnn" is parsed the declationSourceStart of the type declaration is wrong.
This bug also created InvalidArgumentException inside ASTConverter. Fixed and test added. ComplianceDiagnoseTest#test0049() the new problems is "----------\n" + "1. ERROR in X.java (at line 6)\n" + " public @MyAnn(\"\",\"\") class Test { \n" + " ^\n" + "Syntax error on token \",\", / expected\n" + "----------\n";
Verified for 3.1 M4 using build I200412140800.