Bug 84736

Summary: Search engine erroneously reports "inaccurate" matches under JUnit plug-in test harness
Product: [Eclipse Project] JDT Reporter: Robert M. Fuhrer <rfuhrer>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 M5   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Robert M. Fuhrer CLA 2005-02-08 15:39:25 EST
For the program below, the refactoring Introduce Factory performs an exact 
search for references to the constructor Cell1() to find all call sites.

Under the JUnit plug-in test harness, the search engine produces results that 
are tagged "inaccurate". Under an ordinary run-time workbench, the results are 
tagged as "accurate".

The code that calls the search engine appears below the example program.

// ======================================================================
package p;

public class Annotation1 {
	public void foo() {
		Cell1 c= new Cell1();
	}
}
@interface Preliminary { }
class Cell1 {
	@Preliminary public Cell1() { }
}

// ==========================================================================

SearchResultGroup[] findCallsTo(IMethod ctor, IJavaProject project) {
    RefactoringStatus status= new RefactoringStatus();
    SearchPattern pat= SearchPattern.createPattern(ctor,
                IJavaSearchConstants.REFERENCES,
                SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE);
    final RefactoringSearchEngine2 engine= new RefactoringSearchEngine2(pat);

    engine.setFiltering(true, true);
    engine.setScope(createSearchScope(method, methodBinding, javaProject));
    engine.setStatus(status);
    engine.searchPattern(new NullProgressMonitor());

    return (SearchResultGroup[]) engine.getResults();
}
Comment 1 Robert M. Fuhrer CLA 2005-02-09 09:41:48 EST
Mea culpa. A typo in the testcase input source led to a mismatch between the CU 
name and the primary type name; hence the inaccurate results. There is no bug 
here. Sorry!
Comment 2 Jerome Lanneluc CLA 2005-02-09 09:50:03 EST
No problem. Closing.