Source:
private SearchResultGroup[] batchFindNewOccurrences(IMethod[] wcNewMethods, final IMethod[] wcOldMethods, ICompilationUnit[] newDeclarationWCs, IProgressMonitor pm, RefactoringStatus status) throws CoreException { pm.beginTask("", 2); SearchPattern refsPattern= RefactoringSearchEngine.createOrPattern(wcNewMethods, IJavaSearchConstants.REFERENCES); SearchParticipant[] searchParticipants= SearchUtils.getDefaultSearchParticipants(); IJavaSearchScope scope= RefactoringScopeFactory.create(wcNewMethods); MethodOccurenceCollector requestor; if (getDelegateUpdating()) { requestor= new MethodOccurenceCollector(getNewElementName()) { @Override public void acceptSearchMatch(ICompilationUnit unit, SearchMatch match) throws CoreException { for (IMethod occurrence : wcOldMethods) { if (occurrence.equals(match.getElement())) { return; } } super.acceptSearchMatch(unit, match); } }; } else requestor= new MethodOccurenceCollector(getNewElementName()); SearchEngine searchEngine= new SearchEngine(fWorkingCopyOwner); ArrayList<ICompilationUnit> needWCs= new ArrayList<>(); HashSet<ICompilationUnit> declaringCUs= new HashSet<>(newDeclarationWCs.length); for (ICompilationUnit newDeclarationWC : newDeclarationWCs) { declaringCUs.add(newDeclarationWC.getPrimary()); } for (SearchResultGroup fOccurrence : fOccurrences) { ICompilationUnit cu= fOccurrence.getCompilationUnit(); if (! declaringCUs.contains(cu)) needWCs.add(cu); } ICompilationUnit[] otherWCs= null; try { otherWCs= RenameAnalyzeUtil.createNewWorkingCopies( needWCs.toArray(new ICompilationUnit[needWCs.size()]), fChangeManager, fWorkingCopyOwner, new SubProgressMonitor(pm, 1)); searchEngine.search(refsPattern, searchParticipants, scope, requestor, new SubProgressMonitor(pm, 1)); } finally { pm.done(); if (otherWCs != null) { for (ICompilationUnit otherWC : otherWCs) { otherWC.discardWorkingCopy(); } } } SearchResultGroup[] newResults= RefactoringSearchEngine.groupByCu(requestor.getResults(), status); return newResults; }

Target:
private SearchResultGroup[] batchFindNewOccurrences(IMethod[] wcNewMethods, final IMethod[] wcOldMethods, ICompilationUnit[] newDeclarationWCs, IProgressMonitor pm, RefactoringStatus status) throws CoreException { pm.beginTask("", 2); SearchPattern refsPattern= RefactoringSearchEngine.createOrPattern(wcNewMethods, IJavaSearchConstants.REFERENCES); SearchParticipant[] searchParticipants= SearchUtils.getDefaultSearchParticipants(); IJavaSearchScope scope= RefactoringScopeFactory.create(wcNewMethods); MethodOccurenceCollector requestor; if (getDelegateUpdating()) { requestor= new MethodOccurenceCollector(getNewElementName()) { @Override public void acceptSearchMatch(ICompilationUnit unit, SearchMatch match) throws CoreException { for (IMethod occurrence : wcOldMethods) { if (occurrence.equals(match.getElement())) { return; } } super.acceptSearchMatch(unit, match); } }; } else requestor= new MethodOccurenceCollector(getNewElementName()); SearchEngine searchEngine= new SearchEngine(fWorkingCopyOwner); ArrayList<ICompilationUnit> needWCs= new ArrayList<>(); HashSet<ICompilationUnit> declaringCUs= new HashSet<>(newDeclarationWCs.length); for (ICompilationUnit newDeclarationWC : newDeclarationWCs) { declaringCUs.add(newDeclarationWC.getPrimary()); } for (SearchResultGroup occurrence : fOccurrences) { ICompilationUnit cu= occurrence.getCompilationUnit(); if (! declaringCUs.contains(cu)) needWCs.add(cu); } ICompilationUnit[] otherWCs= null; try { otherWCs= RenameAnalyzeUtil.createNewWorkingCopies( needWCs.toArray(new ICompilationUnit[needWCs.size()]), fChangeManager, fWorkingCopyOwner, new SubProgressMonitor(pm, 1)); searchEngine.search(refsPattern, searchParticipants, scope, requestor, new SubProgressMonitor(pm, 1)); } finally { pm.done(); if (otherWCs != null) { for (ICompilationUnit otherWC : otherWCs) { otherWC.discardWorkingCopy(); } } } SearchResultGroup[] newResults= RefactoringSearchEngine.groupByCu(requestor.getResults(), status); return newResults; }