Buggy code:
public class SearchEngine { private ICompilationUnit [ ] workingCopies = null ; public static boolean VERBOSE = false ; public SearchEngine ( ) { } public SearchEngine ( IWorkingCopy [ ] workingCopies ) { } public SearchEngine ( WorkingCopyOwner workingCopyOwner ) { } private ICompilationUnit [ ] filterWorkingCopies ( ICompilationUnit [ ] copies , IJavaElement focus , boolean isPolymorphicSearch ) { } public static IJavaSearchScope createHierarchyScope ( IType type ) throws JavaModelException { } public static IJavaSearchScope createHierarchyScope ( IType type , WorkingCopyOwner owner ) throws JavaModelException { } public static IJavaSearchScope createJavaSearchScope ( IResource [ ] resources ) { } public static IJavaSearchScope createJavaSearchScope ( IJavaElement [ ] elements ) { } public static IJavaSearchScope createJavaSearchScope ( IJavaElement [ ] elements , boolean includeReferencedProjects ) { } public static ISearchPattern createOrSearchPattern ( ISearchPattern leftPattern , ISearchPattern rightPattern ) { } public static ISearchPattern createSearchPattern ( String stringPattern , int searchFor , int limitTo , boolean isCaseSensitive ) { } public static ISearchPattern createSearchPattern ( IJavaElement element , int limitTo ) { } public static IJavaSearchScope createWorkspaceScope ( ) { } private IResource getResource ( IJavaElement element ) { } private ICompilationUnit [ ] getWorkingCopies ( IJavaElement element ) { } public void search ( IWorkspace workspace , String patternString , int searchFor , int limitTo , IJavaSearchScope scope , IJavaSearchResultCollector resultCollector ) throws JavaModelException { } public void search ( IWorkspace workspace , IJavaElement element , int limitTo , IJavaSearchScope scope , IJavaSearchResultCollector resultCollector ) throws JavaModelException { } public void search ( IWorkspace workspace , ISearchPattern searchPattern , IJavaSearchScope scope , IJavaSearchResultCollector resultCollector ) throws JavaModelException { long start = - 1 ; if ( SearchEngine . VERBOSE ) { start = System . currentTimeMillis ( ) ; System . out . println ( ( ( ( "Searching<seq2seq4repair_space>for<seq2seq4repair_space>" + searchPattern ) + "<seq2seq4repair_space>in<seq2seq4repair_space>" ) + scope ) ) ; } resultCollector . aboutToStart ( ) ; MatchLocator matchLocator = null ; try { if ( searchPattern == null ) return ; IProgressMonitor progressMonitor = resultCollector . getProgressMonitor ( ) ; if ( progressMonitor != null ) { progressMonitor . beginTask ( Util . bind ( "engine.searching" ) , 100 ) ; } PathCollector pathCollector = new PathCollector ( ) ; SearchPattern pattern = ( ( SearchPattern ) ( searchPattern ) ) ; if ( scope instanceof HierarchyScope ) { ( ( HierarchyScope ) ( scope ) ) . needsRefresh = false ; <START_BUG> pattern . needsResolve = true ; <END_BUG> } IndexManager indexManager = JavaModelManager . getJavaModelManager ( ) . getIndexManager ( ) ; int detailLevel = ( IInfoConstants . PathInfo ) | ( IInfoConstants . PositionInfo ) ; matchLocator = new MatchLocator ( pattern , detailLevel , resultCollector , scope , ( progressMonitor == null ? null : new SubProgressMonitor ( progressMonitor , 95 ) ) ) ; indexManager . performConcurrentJob ( new PatternSearchJob ( pattern , scope , pattern . focus , pattern . isPolymorphicSearch ( ) , detailLevel , pathCollector , indexManager ) , IJavaSearchConstants . WAIT_UNTIL_READY_TO_SEARCH , ( progressMonitor == null ? null : new SubProgressMonitor ( progressMonitor , 5 ) ) ) ; if ( ( progressMonitor != null ) && ( progressMonitor . isCanceled ( ) ) ) throw new OperationCanceledException ( ) ; matchLocator . locateMatches ( pathCollector . getPaths ( ) , workspace , filterWorkingCopies ( this . workingCopies , pattern . focus , pattern . isPolymorphicSearch ( ) ) ) ; if ( ( progressMonitor != null ) && ( progressMonitor . isCanceled ( ) ) ) throw new OperationCanceledException ( ) ; if ( progressMonitor != null ) { progressMonitor . done ( ) ; } matchLocator . locatePackageDeclarations ( workspace ) ; } finally { resultCollector . done ( ) ; if ( SearchEngine . VERBOSE ) { System . out . println ( ( ( "Total<seq2seq4repair_space>time:<seq2seq4repair_space>" + ( ( System . currentTimeMillis ( ) ) - start ) ) + "ms" ) ) ; if ( matchLocator != null ) System . out . println ( ( ( "Time<seq2seq4repair_space>in<seq2seq4repair_space>result<seq2seq4repair_space>collector:<seq2seq4repair_space>" + ( matchLocator . resultCollectorTime ) ) + "ms" ) ) ; } } } public void searchAllTypeNames ( IWorkspace workspace , char [ ] packageName , char [ ] typeName , int matchMode , boolean isCaseSensitive , int searchFor , IJavaSearchScope scope , final ITypeNameRequestor nameRequestor , int waitingPolicy , IProgressMonitor progressMonitor ) throws JavaModelException { } public void searchDeclarationsOfAccessedFields ( IWorkspace workspace , IJavaElement enclosingElement , IJavaSearchResultCollector resultCollector ) throws JavaModelException { } public void searchDeclarationsOfReferencedTypes ( IWorkspace workspace , IJavaElement enclosingElement , IJavaSearchResultCollector resultCollector ) throws JavaModelException { } public void searchDeclarationsOfSentMessages ( IWorkspace workspace , IJavaElement enclosingElement , IJavaSearchResultCollector resultCollector ) throws JavaModelException { } }

Fix:
pattern . mustResolve = true ;