Community
Participate
Working Groups
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.
Agreed. The current behavior of these methods is incorrect and should be fixed.
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.