Bug 33625

Summary: Searching for field references with SearchEngine returns some incorrect results
Product: [Eclipse Project] JDT Reporter: Lance Walton <lance>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3    
Version: 2.1   
Target Milestone: 2.1 RC2   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Lance Walton CLA 2003-03-02 11:46:14 EST
Suppose we have the following class:

public class SearchEngineTest {
	public void test() {
		System.out.println();
	}
}
Comment 1 Lance Walton CLA 2003-03-02 11:47:26 EST
My report seems to be missing it's end. Here is the rest:

We search SearchEngineTest using:

SearchEngine searchEngine = new SearchEngine();
searchEngine.search(
	workspace,
	SearchEngine.createSearchPattern("*", IJavaSearchConstants.FIELD, IJavaSearchConstants.REFERENCES, false),
	SearchEngine.createJavaSearchScope(new ICompilationUnit[] {compilationUnit}),
	resultCollector
);

where compilationUnit is the compilation unit of the test class above and resultCollector is some implementation of IJavaSearchResultCollector.

The accept() method of IJavaSearchResultCollector gets called with start and end indexes that identify 'System' and 'out' as referenced fields. 'out' is understandable but 'System' is not.

Also, if we insert a space before 'out' in the SearchEngineTest class above, then this space is included in the range specified by the 'start' and 'end' parameters in the accept() method.

Lance
Comment 2 Jerome Lanneluc CLA 2003-03-02 17:10:13 EST
Which build are you using? In latest integration build (I20030227), I see the 
correct source range reported for 'out' and 'System' is not reported as a match.
Comment 3 Lance Walton CLA 2003-03-02 17:23:25 EST
I'm using 200302061700 (on Mac)
Comment 4 Philipe Mulet CLA 2003-03-03 05:12:59 EST
Lance - Can you reproduce it on latest integration build ?
Comment 5 Lance Walton CLA 2003-03-04 18:30:56 EST
Nope. The latest integration build fixes it.

Taa,

Lance
Comment 6 Philipe Mulet CLA 2003-03-05 12:25:11 EST
Thanks, closing