Bug 80714 - Strange syntax diagnosis with incorrect annotations
Summary: Strange syntax diagnosis with incorrect annotations
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M4   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-10 13:24 EST by David Audel CLA
Modified: 2004-12-14 11:32 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Audel CLA 2004-12-10 13:24:18 EST
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
Comment 1 David Audel CLA 2004-12-10 13:27:12 EST
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.
Comment 2 David Audel CLA 2004-12-10 13:39:31 EST
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";
Comment 3 Frederic Fusier CLA 2004-12-14 11:32:25 EST
Verified for 3.1 M4 using build I200412140800.