Buggy code:
protected char [ ] simpleName ; protected char [ ] decodedSimpleName ; protected char [ ] currentTag ; protected char [ ] [ ] segments ; protected int currentSegment ; protected char [ ] decodedSegment ; protected static char [ ] [ ] TAGS = new char [ ] [ ] { TYPE_REF , IIndexConstants . SUPER_REF , IIndexConstants . REF , IIndexConstants . CONSTRUCTOR_REF } ; protected static char [ ] [ ] REF_TAGS = new char [ ] [ ] { IIndexConstants . REF } ; public TypeReferencePattern ( char [ ] qualification , char [ ] simpleName , int matchMode , boolean isCaseSensitive ) { } protected void acceptPath ( IIndexSearchRequestor requestor , String path ) { } protected void decodeIndexEntry ( IEntryResult entryResult ) { } public void findIndexMatches ( IndexInput input , IIndexSearchRequestor requestor , int detailLevel , IProgressMonitor progressMonitor , IJavaSearchScope scope ) throws IOException { } protected boolean hasNextQuery ( ) { } protected char [ ] indexEntryPrefix ( ) { } protected int matchContainer ( ) { } protected boolean matchIndexEntry ( ) { } public int matchLevel ( AstNode node , boolean resolve ) { } public int matchLevel ( Binding binding ) { } protected int matchLevel ( ImportReference importRef , boolean resolve ) { } protected int matchLevel ( NameReference nameRef , boolean resolve ) { if ( ! resolve ) { if ( ( this . simpleName ) == null ) return this . mustResolve ? POTENTIAL_MATCH : ACCURATE_MATCH ; if ( nameRef instanceof SingleNameReference ) return matchesName ( this . simpleName , ( ( SingleNameReference ) ( nameRef ) ) . token ) ? POTENTIAL_MATCH : IMPOSSIBLE_MATCH ; char [ ] [ ] tokens = ( ( QualifiedNameReference ) ( nameRef ) ) . tokens ; for ( int i = 0 , max = tokens . length ; i < max ; i ++ ) if ( this . matchesName ( this . simpleName , tokens [ i ] ) ) return POTENTIAL_MATCH ; return IMPOSSIBLE_MATCH ; } Binding binding = nameRef . binding ; if ( nameRef instanceof SingleNameReference ) { if ( binding instanceof ProblemReferenceBinding ) binding = ( ( ProblemReferenceBinding ) ( binding ) ) . original ; if ( binding instanceof VariableBinding ) return IMPOSSIBLE_MATCH ; if ( ! ( binding instanceof TypeBinding ) ) return INACCURATE_MATCH ; return matchLevelForType ( this . simpleName , this . qualification , ( ( TypeBinding ) ( binding ) ) ) ; } 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 : if ( binding instanceof ProblemReferenceBinding ) binding = ( ( ProblemReferenceBinding ) ( binding ) ) . original ; if ( ! ( binding instanceof TypeBinding ) ) 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 ) { ProblemReferenceBinding pbBinding = ( ( ProblemReferenceBinding ) ( binding ) ) ; binding = pbBinding . original ; if ( ! ( binding instanceof TypeBinding ) ) return INACCURATE_MATCH ; typeBinding = ( ( TypeBinding ) ( binding ) ) ; char [ ] [ ] partialQualifiedName = pbBinding . compoundName ; lastIndex = ( partialQualifiedName == null ) ? - 1 : ( partialQualifiedName . length ) - 1 ; if ( ( typeBinding == null ) || ( lastIndex < 0 ) ) return INACCURATE_MATCH ; } break ; } while ( ( typeBinding != null ) && ( lastIndex >= 0 ) ) { if ( this . matchesName ( this . simpleName , tokens [ ( lastIndex -- ) ] ) ) { <START_BUG> int level = this . matchLevelForType ( this . simpleName , this . qualification , typeBinding ) ; <END_BUG> if ( level != ( IMPOSSIBLE_MATCH ) ) return level ; } if ( typeBinding instanceof ReferenceBinding ) typeBinding = ( ( ReferenceBinding ) ( typeBinding ) ) . enclosingType ( ) ; else typeBinding = null ; } return IMPOSSIBLE_MATCH ; } protected int matchLevel ( TypeReference typeRef , boolean resolve ) { } protected void matchReportImportRef ( ImportReference importRef , Binding binding , IJavaElement element , int accuracy , MatchLocator locator ) throws CoreException { } protected void matchReportReference ( ArrayTypeReference arrayRef , IJavaElement element , int accuracy , MatchLocator locator ) throws CoreException { } 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 ( ) { } }

Fix:
int level = matchLevelForType ( this . simpleName , this . qualification , typeBinding ) ;