Buggy code:
public class TypeReferencePattern extends MultipleSearchPattern { private char [ ] qualification ; private char [ ] simpleName ; private char [ ] decodedQualification ; private char [ ] decodedSimpleName ; private static char [ ] [ ] TAGS = new char [ ] [ ] { TYPE_REF , SUPER_REF , REF , CONSTRUCTOR_REF } ; private static char [ ] [ ] REF_TAGS = new char [ ] [ ] { REF } ; private char [ ] [ ] segments ; private int currentSegment ; private char [ ] decodedSegment ; public TypeReferencePattern ( char [ ] qualification , char [ ] simpleName , int matchMode , boolean isCaseSensitive ) { } public void decodeIndexEntry ( IEntryResult entryResult ) { } public void feedIndexRequestor ( IIndexSearchRequestor requestor , int detailLevel , int [ ] references , IndexInput input , IJavaSearchScope scope ) throws IOException { } protected char [ ] [ ] getPossibleTags ( ) { } protected boolean hasNextQuery ( ) { } public char [ ] indexEntryPrefix ( ) { } protected int matchContainer ( ) { } protected boolean matchIndexEntry ( ) { } protected void matchReportReference ( AstNode reference , IJavaElement element , int accuracy , MatchLocator locator ) throws CoreException { } protected void matchReportReference ( QualifiedNameReference qNameRef , IJavaElement element , int accuracy , MatchLocator locator ) throws CoreException { } protected void matchReportReference ( QualifiedTypeReference qTypeRef , IJavaElement element , int accuracy , MatchLocator locator ) throws CoreException { } protected void resetQuery ( ) { } public String toString ( ) { } public int matchLevel ( AstNode node , boolean resolve ) { } private int matchLevel ( ImportReference importRef , boolean resolve ) { } private int matchLevel ( NameReference nameRef , boolean resolve ) { if ( ! resolve ) { if ( ( this . simpleName ) == null ) { return this . needsResolve ? POSSIBLE_MATCH : ACCURATE_MATCH ; } else { if ( nameRef instanceof SingleNameReference ) { if ( this . matchesName ( this . simpleName , ( ( SingleNameReference ) ( nameRef ) ) . token ) ) { return POSSIBLE_MATCH ; } else { return IMPOSSIBLE_MATCH ; } } else { char [ ] [ ] tokens = ( ( QualifiedNameReference ) ( nameRef ) ) . tokens ; for ( int i = 0 , max = tokens . length ; i < max ; i ++ ) { if ( this . matchesName ( this . simpleName , tokens [ i ] ) ) { return POSSIBLE_MATCH ; } } return IMPOSSIBLE_MATCH ; } } } else { Binding binding = nameRef . binding ; if ( nameRef instanceof SingleNameReference ) { if ( ( binding == null ) || ( binding instanceof ProblemBinding ) ) { return INACCURATE_MATCH ; } else if ( binding instanceof TypeBinding ) { return this . matchLevelForType ( this . simpleName , this . qualification , ( ( TypeBinding ) ( binding ) ) ) ; } else { return IMPOSSIBLE_MATCH ; } } else { TypeBinding typeBinding = null ; QualifiedNameReference qNameRef = ( ( QualifiedNameReference ) ( nameRef ) ) ; char [ ] [ ] tokens = qNameRef . tokens ; int lastIndex = ( tokens . length ) - 1 ; switch ( ( qNameRef . bits ) & ( AstNode . RestrictiveFlagMASK ) ) { case BindingIds . FIELD : typeBinding = nameRef . actualReceiverType ; int otherBindingsCount = ( ( qNameRef . otherBindings ) == null ) ? 0 : qNameRef . otherBindings . length ; lastIndex -= otherBindingsCount + 1 ; if ( lastIndex < 0 ) return IMPOSSIBLE_MATCH ; break ; case BindingIds . LOCAL : return IMPOSSIBLE_MATCH ; case BindingIds . TYPE : <START_BUG> if ( binding instanceof ProblemReferenceBinding ) { <END_BUG> return INACCURATE_MATCH ; } typeBinding = ( ( TypeBinding ) ( binding ) ) ; break ; case BindingIds . VARIABLE : case ( BindingIds . TYPE ) | ( BindingIds . VARIABLE ) : if ( binding instanceof ProblemBinding ) { ProblemBinding pbBinding = ( ( ProblemBinding ) ( binding ) ) ; typeBinding = pbBinding . searchType ; char [ ] partialQualifiedName = pbBinding . name ; lastIndex = ( CharOperation . occurencesOf ( '.' , partialQualifiedName ) ) - 1 ; if ( ( typeBinding == null ) || ( lastIndex < 0 ) ) return INACCURATE_MATCH ; } else if ( binding instanceof ProblemReferenceBinding ) { return INACCURATE_MATCH ; } break ; } while ( ( typeBinding != null ) && ( lastIndex >= 0 ) ) { if ( this . matchesName ( this . simpleName , tokens [ ( lastIndex -- ) ] ) ) { int level = this . matchLevelForType ( this . simpleName , this . qualification , typeBinding ) ; if ( level != ( IMPOSSIBLE_MATCH ) ) { return level ; } } if ( typeBinding instanceof ReferenceBinding ) { typeBinding = ( ( ReferenceBinding ) ( typeBinding ) ) . enclosingType ( ) ; } else { typeBinding = null ; } } return IMPOSSIBLE_MATCH ; } } } protected void matchReportReference ( ArrayTypeReference arrayRef , IJavaElement element , int accuracy , MatchLocator locator ) throws CoreException { } private int matchLevel ( TypeReference typeRef , boolean resolve ) { } protected void matchReportImportRef ( ImportReference importRef , Binding binding , IJavaElement element , int accuracy , MatchLocator locator ) throws CoreException { } public int matchLevel ( Binding binding ) { } }

Fix:
if ( ! ( binding instanceof TypeBinding ) ) {