Bug 33625 - Searching for field references with SearchEngine returns some incorrect results
Summary: Searching for field references with SearchEngine returns some incorrect results
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 2.1 RC2   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-02 11:46 EST by Lance Walton CLA
Modified: 2003-03-05 12:25 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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