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 { char [ ] [ ] tokens = null ; Binding binding = qNameRef . binding ; TypeBinding typeBinding = null ; char [ ] [ ] nameTokens = qNameRef . tokens ; int lastIndex = ( nameTokens . length ) - 1 ; switch ( ( qNameRef . bits ) & ( AstNode . RestrictiveFlagMASK ) ) { case BindingIds . FIELD : <START_BUG> typeBinding = ( ( FieldBinding ) ( binding ) ) . declaringClass ; <END_BUG> int otherBindingsCount = ( ( qNameRef . otherBindings ) == null ) ? 0 : qNameRef . otherBindings . length ; lastIndex -= otherBindingsCount + 1 ; break ; case BindingIds . TYPE : typeBinding = ( ( TypeBinding ) ( binding ) ) ; } while ( ( typeBinding != null ) && ( lastIndex >= 0 ) ) { if ( this . matchesName ( this . simpleName , nameTokens [ ( lastIndex -- ) ] ) ) { int level = this . matchLevelForType ( this . simpleName , this . qualification , typeBinding ) ; if ( level != ( IMPOSSIBLE_MATCH ) ) { tokens = new char [ lastIndex + 2 ] [ ] ; System . arraycopy ( nameTokens , 0 , tokens , 0 , ( lastIndex + 2 ) ) ; break ; } } if ( typeBinding instanceof ReferenceBinding ) { typeBinding = ( ( ReferenceBinding ) ( typeBinding ) ) . enclosingType ( ) ; } else { typeBinding = null ; } } if ( tokens == null ) { if ( ( binding == null ) || ( binding instanceof ProblemBinding ) ) { tokens = new char [ ] [ ] { this . simpleName } ; } else { tokens = qNameRef . tokens ; } if ( ! ( this . isCaseSensitive ) ) { int length = tokens . length ; char [ ] [ ] lowerCaseTokens = new char [ length ] [ ] ; for ( int i = 0 ; i < length ; i ++ ) { char [ ] token = tokens [ i ] ; lowerCaseTokens [ i ] = CharOperation . toLowerCase ( token ) ; } tokens = lowerCaseTokens ; } } locator . reportAccurateReference ( qNameRef . sourceStart , qNameRef . sourceEnd , tokens , element , accuracy ) ; } 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 ) { } protected void matchReportReference ( ArrayTypeReference arrayRef , IJavaElement element , int accuracy , MatchLocator locator ) throws CoreException { } private int matchLevel ( TypeReference typeRef , boolean resolve ) { } public int matchLevel ( Binding binding ) { } }

Fix:
typeBinding = qNameRef . actualReceiverType ;