Bug 5384

Summary: search engine: behavior different than expected
Product: [Eclipse Project] JDT Reporter: Adam Kiezun <akiezun>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: 2.0 M1   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Adam Kiezun CLA 2001-10-31 10:57:00 EST
i'd like to use the methods on SearchEngine:

searchDeclarationsOfAccessedFields
searchDeclarationsOfReferencedTypes
searchDeclarationsOfSentMessages

however, they very much do not do what i'd like to see:
1. when using searchDeclarationsOfAccessedFields, i'd like to get matches 
 with enclosingJavaElement being IField - these matches should be the field 
declarations (as the name suggests)

2. these matches do not have to be in the java element specified as enclosing.
in fact, when using searchDeclarationsOfReferencedTypes, for instance, i expect 
them to be possibly in many different files.

to put it short- i'd like too see these methods do what their names suggest:
searchDeclarationsOfReferencedTypes - should find declarations of referenced 
types etc. (*declarations*, not just references to types).

i'd like to use these methods to quickly "analyze" code of a method, for 
instance, to see what fields it accesses, what types it uses, what other 
methods it invokes.
Comment 1 Jerome Lanneluc CLA 2001-11-02 07:07:45 EST
Agreed. The current behavior of these methods is incorrect and should be fixed.
Comment 2 Jerome Lanneluc CLA 2001-11-20 12:50:22 EST
Implemented correct behavior by using 3 new patterns:
- DeclarationOfAccessedFieldsPattern that extends FieldReferencePattern
- DeclarationOfReferencedTypesPattern that extends TypeReferencePattern
- DeclarationOfReferencedMethodsPattern that extends MethodReferencePattern

They all redefine the reportReference method by searching for the corresponding 
declaration and reporting it instead of the reference.