Community
Participate
Working Groups
It appears that the SearchEngine can't find all fields in multiple field declarations. For example, take the compiled method from the class: -------- public class TestCase { int field1, field2, field3; int field4; public void method(){} } -------- when you run the following code (a pretty vanilla search): -------- final List searchResults = new ArrayList(); SearchRequestor collector = new SearchRequestor(){ public void acceptSearchMatch(SearchMatch match) throws CoreException { searchResults.add(match); } }; SearchPattern pattern = SearchPattern.createPattern("*", IJavaSearchConstants.FIELD, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_PATTERN_MATCH); SearchParticipant[] participants = new SearchParticipant[] {SearchEngine.getDefaultSearchParticipant()}; JavaSearchScope scope = new JavaSearchScope(); scope.add(unit); new SearchEngine().search(pattern,participants,scope,collector,monitor); -------- searchResults only contains two elements - field1 and field4. I would expect field1, field2, field3, and field4. This can also be confirmed by doing a standard GUI Java Search of the same example class.
Fixed and released in HEAD. This bug will be targeted for 3.0.2 when available and released in R3_0_maintenance stream after 3.0.1 is shipped... Now package multiple fields declaration are found by SearchEngine correctly. [jdt-core-internal] Changes done in MatchLocator.reportMatching(FieldDeclaration,...) method. Test cases added in JavaSearchTests
Fixed and released in R3_0_maintenance stream. Bug Target still needs to be set to 3.0.2 when it will be available...
Setting target to 3.1 M2 while waiting for 3.0.2 one...
Verified in I200409230100.
Reopen to change status
Change status to fixed
Finally set status as VERIFIED. We'll only change target when fix will be definitely put in R3_0_maintenance stream...
Candidating fix for 3.0.2 release (not committed yet)
Verified with M20050216