Bug 83012

Summary: [1.5][search][annot] Search for annotations misses references in default and values constructs
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Markus Keller CLA 2005-01-17 14:41:21 EST
I20050112-1200

Search for annotations misses references in default and values constructs. In
the example below, only one of three references is found:

@interface A {
    String value() default "";
}

@interface Main {
   A child() default @A("Void");
}

@Main(child=@/*test*/A(""))
class Client {
}
Comment 1 Frederic Fusier CLA 2005-04-25 12:53:10 EDT
Fixed and released in HEAD.

All references are now found, even those in annotation member values.

[jdt-core-internal]
Changes done in:
- SourceElementParser, MatchLocatorParser:
    remove override of consumeAnnotationAsModifier and replace it with 
    consumeMarkerAnnotation, consumeNormalAnnotation.
    Also modify consumeSingleMemberAnnotation.
- MatchLocator:
    modify reportMatching(Annotation[],...) to report reference inside member
    value
- PatternLocator:
    add method matchNode(Annotation, MatchingNodeSet)
- MethodLocator:
    + add method matchNode(Annotation, MatchingNodeSet) to add possible matches
    when annotation member value pairs match method pattern
    + modify resolveLevel(ASTNode) to resolve SingleMemberAnnotation using its
    unique member value pair binding
- TypeReferenceLocator:
    + add method matchNode(Annotation, MatchingNodeSet) to add possible matches
    when annotation type match type reference pattern

Test cases added in JavaSearchBugsTests
Comment 2 Maxime Daniel CLA 2005-05-11 04:41:27 EDT
Verified for 3.1 M7 using build I20050509-2010 + jdt.core HEAD.