Buggy code:
public class MatchLocator implements ITypeRequestor { public SearchPattern pattern ; public int detailLevel ; public IJavaSearchResultCollector collector ; public IJavaSearchScope scope ; public MatchLocatorParser parser ; public LookupEnvironment lookupEnvironment ; public HashtableOfObject parsedUnits ; private PotentialMatch [ ] potentialMatches ; private int potentialMatchesIndex ; private int potentialMatchesLength ; public MatchLocator ( SearchPattern pattern , int detailLevel , IJavaSearchResultCollector collector , IJavaSearchScope scope ) { } public void accept ( IBinaryType binaryType , PackageBinding packageBinding ) { } public void accept ( ICompilationUnit sourceUnit ) { } public void accept ( ISourceType [ ] sourceTypes , PackageBinding packageBinding ) { } public IField createFieldHandle ( FieldDeclaration field , IType type ) { } public IJavaElement createImportHandle ( ImportReference importRef ) { } public IInitializer createInitializerHandle ( TypeDeclaration typeDecl , FieldDeclaration initializer , IType type ) { } public IMethod createMethodHandle ( AbstractMethodDeclaration method , IType type ) { } public IType createTypeHandle ( char [ ] simpleTypeName ) { } public IType createTypeHandle ( IType parent , char [ ] simpleTypeName ) { } protected IResource getCurrentResource ( ) { } protected boolean includesPotentialMatch ( PotentialMatch potentialMatch ) { } protected Scanner getScanner ( ) { } public void locateMatches ( String [ ] filePaths , IWorkspace workspace ) throws JavaModelException { } public void locatePackageDeclarations ( IWorkspace workspace ) throws JavaModelException { } private void locatePackageDeclarations ( SearchPattern searchPattern , IWorkspace workspace ) throws JavaModelException { } public void report ( int sourceStart , int sourceEnd , IJavaElement element , int accuracy ) throws CoreException { } public void reportBinaryMatch ( IMember binaryMember , IBinaryType info , int accuracy ) throws CoreException , JavaModelException { } public void reportFieldDeclaration ( FieldDeclaration fieldDeclaration , IJavaElement parent , int accuracy ) throws CoreException { } public void reportImport ( ImportReference reference , int accuracy ) throws CoreException { } public void reportMethodDeclaration ( AbstractMethodDeclaration methodDeclaration , IJavaElement parent , int accuracy ) throws CoreException { } public void reportPackageDeclaration ( ImportReference node ) { } public void reportPackageReference ( ImportReference node ) { } public void reportAccurateReference ( int sourceStart , int sourceEnd , char [ ] [ ] qualifiedName , IJavaElement element , int accuracy ) throws CoreException { } public void reportAccurateReference ( int sourceStart , int sourceEnd , char [ ] [ ] qualifiedName , IJavaElement element , int [ ] accuracies , boolean accuracyStartsOnFirstToken ) throws CoreException { Scanner scanner = parser . scanner ; scanner . setSourceBuffer ( this . potentialMatches [ this . potentialMatchesIndex ] . getSource ( ) ) ; scanner . resetTo ( sourceStart , sourceEnd ) ; int refSourceStart = - 1 ; int refSourceEnd = - 1 ; int tokenNumber = qualifiedName . length ; int token = - 1 ; int previousValid = - 1 ; int i = 0 ; int accuracyIndex = 0 ; do { int currentPosition = scanner . currentPosition ; try { token = scanner . getNextToken ( ) ; } catch ( InvalidInputException e ) { } if ( token != ( TerminalSymbols . TokenNameEOF ) ) { char [ ] currentTokenSource = scanner . getCurrentTokenSource ( ) ; boolean equals = false ; <START_BUG> while ( ( i < tokenNumber ) && ( ! ( equals = this . pattern . matchesName ( qualifiedName [ ( i ++ ) ] , currentTokenSource ) ) ) ) { <END_BUG> } if ( equals && ( ( previousValid == ( - 1 ) ) || ( previousValid == ( i - 2 ) ) ) ) { previousValid = i - 1 ; if ( refSourceStart == ( - 1 ) ) { refSourceStart = currentPosition ; } refSourceEnd = ( scanner . currentPosition ) - 1 ; } else { i = 0 ; refSourceStart = - 1 ; previousValid = - 1 ; } try { token = scanner . getNextToken ( ) ; } catch ( InvalidInputException e ) { } } if ( i == tokenNumber ) { if ( ( accuracies [ accuracyIndex ] ) != ( - 1 ) ) { if ( refSourceStart != ( - 1 ) ) { this . report ( refSourceStart , refSourceEnd , element , accuracies [ accuracyIndex ] ) ; } else { this . report ( sourceStart , sourceEnd , element , accuracies [ accuracyIndex ] ) ; } i = 0 ; refSourceStart = - 1 ; previousValid = - 1 ; } } if ( accuracyStartsOnFirstToken ) { accuracyIndex ++ ; } } while ( ( token != ( TerminalSymbols . TokenNameEOF ) ) && ( accuracyIndex < ( accuracies . length ) ) ) ; } public void reportReference ( AstNode reference , AbstractMethodDeclaration methodDeclaration , IJavaElement parent , int accuracy ) throws CoreException { } public void reportReference ( AstNode reference , TypeDeclaration typeDeclaration , FieldDeclaration fieldDeclaration , IJavaElement parent , int accuracy ) throws CoreException { } public void reportSuperTypeReference ( TypeReference typeRef , IJavaElement type , int accuracy ) throws CoreException { } public void reportTypeDeclaration ( TypeDeclaration typeDeclaration , IJavaElement parent , int accuracy ) throws CoreException { } private PotentialMatch newPotentialMatch ( IResource resource , Openable openable ) { } private void addPotentialMatch ( IResource resource , Openable openable ) throws JavaModelException { } private void addPotentialMatch ( PotentialMatch potentialMatch ) { } private boolean createParser ( JavaProject project ) throws JavaModelException { } protected Openable getCurrentOpenable ( ) { } private void locateMatches ( ) throws JavaModelException { } }

Fix:
while ( ( i < tokenNumber ) && ( ! ( equals = CharOperation . equals ( qualifiedName [ ( i ++ ) ] , currentTokenSource ) ) ) ) {