Buggy code:
public class MatchLocator implements ITypeRequestor { public static final int MAX_AT_ONCE = 500 ; public SearchPattern pattern ; public PatternLocator patternLocator ; public int matchContainer ; public int detailLevel ; public IJavaSearchResultCollector collector ; public IJavaSearchScope scope ; public IProgressMonitor progressMonitor ; public ICompilationUnit [ ] workingCopies ; public HandleFactory handleFactory ; public char [ ] [ ] [ ] allSuperTypeNames ; public MatchLocatorParser parser ; private Parser basicParser ; public INameEnvironment nameEnvironment ; public NameLookup nameLookup ; public LookupEnvironment lookupEnvironment ; public HierarchyResolver hierarchyResolver ; public CompilerOptions options ; public int numberOfMatches ; public PossibleMatch [ ] matchesToProcess ; public PossibleMatch currentPossibleMatch ; public long resultCollectorTime = 0 ; public class LocalDeclarationVisitor extends AbstractSyntaxTreeVisitorAdapter { IJavaElement enclosingElement ; MatchingNodeSet nodeSet ; public LocalDeclarationVisitor ( IJavaElement enclosingElement , MatchingNodeSet nodeSet ) { } public boolean visit ( AnonymousLocalTypeDeclaration anonymousTypeDeclaration , BlockScope unused ) { } public boolean visit ( LocalTypeDeclaration typeDeclaration , BlockScope unused ) { } } public class WrappedCoreException extends RuntimeException { public CoreException coreException ; public WrappedCoreException ( CoreException coreException ) { } } public static ClassFileReader classFileReader ( IType type ) { } public MatchLocator ( SearchPattern pattern , int detailLevel , IJavaSearchResultCollector collector , IJavaSearchScope scope , IProgressMonitor progressMonitor ) { } public void accept ( IBinaryType binaryType , PackageBinding packageBinding ) { } public void accept ( org . eclipse . jdt . internal . compiler . env . ICompilationUnit sourceUnit ) { CompilationResult unitResult = new CompilationResult ( sourceUnit , 1 , 1 , this . options . maxProblemsPerUnit ) ; try { CompilationUnitDeclaration parsedUnit = basicParser ( ) . dietParse ( sourceUnit , unitResult ) ; lookupEnvironment . buildTypeBindings ( parsedUnit ) ; <START_BUG> lookupEnvironment . completeTypeBindings ( parsedUnit ) ; <END_BUG> } catch ( AbortCompilationUnit e ) { if ( ( unitResult . compilationUnit ) == sourceUnit ) { } else { throw e ; } } } public void accept ( ISourceType [ ] sourceTypes , PackageBinding packageBinding ) { } protected Parser basicParser ( ) { } protected void buildBindings ( PossibleMatch possibleMatch ) { } protected BinaryTypeBinding cacheBinaryType ( IType type ) throws JavaModelException { } protected char [ ] [ ] [ ] computeSuperTypeNames ( IType focusType ) { } protected IJavaElement createHandle ( AbstractMethodDeclaration method , IJavaElement parent ) { } protected IJavaElement createHandle ( FieldDeclaration fieldDeclaration , TypeDeclaration typeDeclaration , IJavaElement parent ) { } protected boolean createHierarchyResolver ( IType focusType , PossibleMatch [ ] possibleMatches ) { } protected IJavaElement createImportHandle ( ImportReference importRef ) { } protected IType createTypeHandle ( String simpleTypeName ) { } protected IBinaryType getBinaryInfo ( ClassFile classFile , IResource resource ) throws CoreException { } protected IType getFocusType ( ) { } protected void getMethodBodies ( CompilationUnitDeclaration unit ) { } protected boolean hasAlreadyDefinedType ( CompilationUnitDeclaration parsedUnit ) { } public void initialize ( JavaProject project , int possibleMatchSize ) throws JavaModelException { } protected void locateMatches ( JavaProject javaProject , PossibleMatch [ ] possibleMatches , int start , int length ) throws JavaModelException { } protected void locateMatches ( JavaProject javaProject , PossibleMatchSet matchSet ) throws JavaModelException { } public void locateMatches ( String [ ] filePaths , IWorkspace workspace , ICompilationUnit [ ] copies ) throws JavaModelException { } public void locatePackageDeclarations ( IWorkspace workspace ) throws JavaModelException { } protected void locatePackageDeclarations ( SearchPattern searchPattern , IWorkspace workspace ) throws JavaModelException { } protected IType lookupType ( ReferenceBinding typeBinding ) { } protected void process ( PossibleMatch possibleMatch , boolean bindingsWereCreated ) throws CoreException { } protected void purgeMethodStatements ( TypeDeclaration type , boolean checkEachMethod ) { } protected void reduceParseTree ( CompilationUnitDeclaration unit ) { } protected void report ( int sourceStart , int sourceEnd , IJavaElement element , int accuracy ) throws CoreException { } protected void report ( IResource resource , int sourceStart , int sourceEnd , IJavaElement element , int accuracy ) throws CoreException { } protected void report ( long start , long end , IJavaElement element , int accuracy ) throws CoreException { } protected void reportAccurateReference ( int sourceStart , int sourceEnd , char [ ] name , IJavaElement element , int accuracy ) throws CoreException { } protected void reportAccurateReference ( int sourceStart , int sourceEnd , char [ ] [ ] tokens , IJavaElement element , int [ ] accuracies ) throws CoreException { } protected void reportBinaryMatch ( IResource resource , IMember binaryMember , IBinaryType info , int accuracy ) throws CoreException { } protected void reportMatching ( AbstractMethodDeclaration method , IJavaElement parent , int accuracy , boolean typeInHierarchy , MatchingNodeSet nodeSet ) throws CoreException { } protected void reportMatching ( CompilationUnitDeclaration unit , boolean mustResolve ) throws CoreException { } protected void reportMatching ( FieldDeclaration field , TypeDeclaration type , IJavaElement parent , int accuracy , boolean typeInHierarchy , MatchingNodeSet nodeSet ) throws CoreException { } protected void reportMatching ( TypeDeclaration type , IJavaElement parent , int accuracy , MatchingNodeSet nodeSet ) throws CoreException { } protected boolean typeInHierarchy ( ReferenceBinding binding ) { } }

Fix:
lookupEnvironment . completeTypeBindings ( parsedUnit , true ) ;