Community
Participate
Working Groups
While looking at bug 108053, I did some tests with following example: Ref.java: package pack; public class Ref {} Test.java: package pack; /** * @see Ref */ public class Test {} I discovered that SearchEngine.searchDeclarationsOfReferencedTypes method does not return any match when the given element is the Test.java ICompilationUnit although I would expect the TypeDeclaration of Ref.java as a valid match... I'll attach a test case which will highlight this problem...
Created attachment 73088 [details] Patch with tests on JavaSearchBugTests
Problem comes from the MatchLocator while locating matches on possibles matches in method locateMatches(JavaProject, PossibleMatch[], int, int). At the end of the method each possible matches stored in 'matchesToProcess' field is processed and cleaned at the end of the loop. Doing this, type bindings scope are set to null but the scope is still necessary while reporting type declaration matches in TypeReferenceLocator.reportDeclaration(ReferenceBinding, int, MatchLocator, SimpleSet) method...
This was not specific to references in javadoc comments => update summary.
Created attachment 73191 [details] Proposed patch Finally the fix does not change anything to the cleanup as it may have performance impact. Instead, it does not add all the SearchEngine compilation units to the found SearchDocument but uses only the given java element parameter of the method searchDeclarationsOfReferencedTypes. Then, there's only one search document which avoid to get problem with clean-up during the loop. All JDT/Core and JDT/UI pass with this fix.
Released for 3.4M1 in HEAD stream.
Verified (with code of added tests) for 3.4M1 using build I20070802-0800.