Community
Participate
Working Groups
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(); }
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!
No problem. Closing.