Buggy code:
public class SearchEngine { private Parser parser ; private CompilerOptions compilerOptions ; private ICompilationUnit [ ] workingCopies ; private WorkingCopyOwner workingCopyOwner ; public static boolean VERBOSE = false ; public SearchEngine ( ) { } public SearchEngine ( IWorkingCopy [ ] workingCopies ) { } public SearchEngine ( WorkingCopyOwner workingCopyOwner ) { } 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 Parser getParser ( ) { } private IResource getResource ( IJavaElement element ) { } private ICompilationUnit [ ] getWorkingCopies ( ) { ICompilationUnit [ ] copies ; if ( ( this . workingCopies ) != null ) { if ( ( this . workingCopyOwner ) == null ) { copies = JavaModelManager . getJavaModelManager ( ) . getWorkingCopies ( DefaultWorkingCopyOwner . PRIMARY , false ) ; if ( copies == null ) { copies = this . workingCopies ; } else { HashMap pathToCUs = new HashMap ( ) ; for ( int i = 0 , length = copies . length ; i < length ; i ++ ) { ICompilationUnit unit = copies [ i ] ; pathToCUs . put ( unit . getPath ( ) , unit ) ; } for ( int i = 0 , length = this . workingCopies . length ; i < length ; i ++ ) { ICompilationUnit unit = this . workingCopies [ i ] ; pathToCUs . put ( unit . getPath ( ) , unit ) ; } int length = pathToCUs . size ( ) ; copies = new ICompilationUnit [ length ] ; pathToCUs . values ( ) . toArray ( copies ) ; } } else { copies = this . workingCopies ; } } else if ( ( this . workingCopyOwner ) != null ) { copies = JavaModelManager . getJavaModelManager ( ) . getWorkingCopies ( this . workingCopyOwner , true ) ; } else { copies = JavaModelManager . getJavaModelManager ( ) . getWorkingCopies ( DefaultWorkingCopyOwner . PRIMARY , false ) ; } if ( copies == null ) return null ; ICompilationUnit [ ] result = null ; int length = copies . length ; int index = 0 ; for ( int i = 0 ; i < length ; i ++ ) { CompilationUnit copy = ( ( CompilationUnit ) ( copies [ i ] ) ) ; try { <START_BUG> if ( ( ( ! ( copy . isPrimary ( ) ) ) || ( copy . hasUnsavedChanges ( ) ) ) || ( ! ( copy . isBasedOn ( copy . getResource ( ) ) ) ) ) { <END_BUG> if ( result == null ) { result = new ICompilationUnit [ length ] ; } result [ ( index ++ ) ] = copy ; } } catch ( JavaModelException e ) { } } if ( ( index != length ) && ( result != null ) ) { System . arraycopy ( result , 0 , ( result = new ICompilationUnit [ index ] ) , 0 , index ) ; } return result ; } 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 { } 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 { } private ICompilationUnit [ ] workingCopiesThatCanSeeFocus ( IJavaElement focus , boolean isPolymorphicSearch ) { } }

Fix:
if ( ( ( ! ( copy . isPrimary ( ) ) ) || ( copy . hasUnsavedChanges ( ) ) ) || ( copy . hasResourceChanged ( ) ) ) {