Summary: | Invalid annotation elements cause no annotation to be in the AST | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Karen Butzke <karenfbutzke> | ||||||
Component: | Core | Assignee: | David Audel <david_audel> | ||||||
Status: | VERIFIED FIXED | QA Contact: | |||||||
Severity: | normal | ||||||||
Priority: | P2 | CC: | jerome_lanneluc, paul.fullbright | ||||||
Version: | 3.1.1 | ||||||||
Target Milestone: | 3.4 M5 | ||||||||
Hardware: | PC | ||||||||
OS: | Windows XP | ||||||||
Whiteboard: | |||||||||
Bug Depends on: | |||||||||
Bug Blocks: | 130790, 130794 | ||||||||
Attachments: |
|
Description
Karen Butzke
2006-03-07 14:16:34 EST
Created attachment 35852 [details]
falings tests for invalid annotation syntax
This attachment contains one JUnit test class with 1 passing test and 2 failing tests. The failing tests start with classes containing the following source code and then try to get the Annotation from the TypeDeclaration.
Source code contains @MyAnnotation(name=)
Source code contains @MyAnnotation(name="foo" , )
More explanation is given in the test class.
Broken annotations are known to cause grief to the syntax recovery currently. Created attachment 87852 [details]
Proposed fix
With this fix annotation name and all correct member value pairs are recovered. This behavior is similar to method declaration recovery (method name and all correct parameters are recovered).
With the following test case
MyAnnotation(name=)
class Foo {}
the recovered ast will be
MyAnnotation
class Foo {}
With the following test case
MyAnnotation(name1="a", name2=)
class Foo {}
the recovered ast will be
MyAnnotation(name1="a")
class Foo {}
This fix also add modifiers recovery.
Released for 3.4M5. Tests added AnnotationDietRecoveryTest#test0013()->test0035() StatementRecoveryTest_1_5#test003()->test0007() ASTConverterBugsTestJLS3#testBug130778a()->testBug130778x() Verified for 3.4M5 using build I20080204-0010. |