Buggy code:
public class TypeReferenceLocator extends PatternLocator { protected TypeReferencePattern pattern ; protected boolean isDeclarationOfReferencedTypesPattern ; private final int fineGrain ; public TypeReferenceLocator ( TypeReferencePattern pattern ) { } protected IJavaElement findElement ( IJavaElement element , int accuracy ) { } protected int fineGrain ( ) { } public int match ( Annotation node , MatchingNodeSet nodeSet ) { } public int match ( ASTNode node , MatchingNodeSet nodeSet ) { } public int match ( Reference node , MatchingNodeSet nodeSet ) { } public int match ( TypeReference node , MatchingNodeSet nodeSet ) { } protected int matchLevel ( ImportReference importRef ) { } protected void matchLevelAndReportImportRef ( ImportReference importRef , Binding binding , MatchLocator locator ) throws CoreException { } protected void matchReportImportRef ( ImportReference importRef , Binding binding , IJavaElement element , int accuracy , MatchLocator locator ) throws CoreException { } protected void matchReportReference ( ArrayTypeReference arrayRef , IJavaElement element , Binding elementBinding , int accuracy , MatchLocator locator ) throws CoreException { } protected void matchReportReference ( ASTNode reference , IJavaElement element , Binding elementBinding , int accuracy , MatchLocator locator ) throws CoreException { } protected void matchReportReference ( ASTNode reference , IJavaElement element , IJavaElement localElement , IJavaElement [ ] otherElements , Binding elementBinding , int accuracy , MatchLocator locator ) throws CoreException { } protected void matchReportReference ( ASTNode reference , IJavaElement element , Binding elementBinding , Scope scope , int accuracy , MatchLocator locator ) throws CoreException { } protected void matchReportReference ( QualifiedNameReference qNameRef , IJavaElement element , Binding elementBinding , int accuracy , MatchLocator locator ) throws CoreException { } protected void matchReportReference ( QualifiedTypeReference qTypeRef , IJavaElement element , Binding elementBinding , int accuracy , MatchLocator locator ) throws CoreException { } void matchReportReference ( Expression expr , int lastIndex , TypeBinding refBinding , MatchLocator locator ) throws CoreException { if ( ( refBinding . isParameterizedType ( ) ) || ( refBinding . isRawType ( ) ) ) { ParameterizedTypeBinding parameterizedBinding = ( ( ParameterizedTypeBinding ) ( refBinding ) ) ; updateMatch ( parameterizedBinding , this . pattern . getTypeArguments ( ) , this . pattern . hasTypeParameters ( ) , 0 , locator ) ; if ( ( match . getRule ( ) ) == 0 ) return ; boolean report = ( ( ( this . isErasureMatch ) && ( match . isErasure ( ) ) ) || ( ( this . isEquivalentMatch ) && ( match . isEquivalent ( ) ) ) ) || ( match . isExact ( ) ) ; if ( ! report ) return ; if ( ( refBinding . isParameterizedType ( ) ) && ( this . pattern . hasTypeArguments ( ) ) ) { TypeReference typeRef = null ; TypeReference [ ] typeArguments = null ; if ( expr instanceof ParameterizedQualifiedTypeReference ) { typeRef = ( ( ParameterizedQualifiedTypeReference ) ( expr ) ) ; typeArguments = ( ( ParameterizedQualifiedTypeReference ) ( expr ) ) . typeArguments [ lastIndex ] ; } else if ( expr instanceof ParameterizedSingleTypeReference ) { typeRef = ( ( ParameterizedSingleTypeReference ) ( expr ) ) ; typeArguments = ( ( ParameterizedSingleTypeReference ) ( expr ) ) . typeArguments ; } if ( typeRef != null ) { locator . reportAccurateParameterizedTypeReference ( match , typeRef , lastIndex , typeArguments ) ; return ; } } } else if ( this . pattern . hasTypeArguments ( ) ) { match . setRule ( SearchPattern . R_ERASURE_MATCH ) ; } if ( expr instanceof ArrayTypeReference ) { locator . reportAccurateTypeReference ( match , expr , this . pattern . simpleName ) ; return ; } if ( refBinding . isLocalType ( ) ) { <START_BUG> LocalTypeBinding local = ( ( LocalTypeBinding ) ( refBinding ) ) ; <END_BUG> IJavaElement focus = ( ( InternalSearchPattern ) ( pattern ) ) . focus ; if ( ( ( focus != null ) && ( ( local . enclosingMethod ) != null ) ) && ( ( focus . getParent ( ) . getElementType ( ) ) == ( IJavaElement . METHOD ) ) ) { IMethod method = ( ( IMethod ) ( focus . getParent ( ) ) ) ; if ( ! ( CharOperation . equals ( local . enclosingMethod . selector , method . getElementName ( ) . toCharArray ( ) ) ) ) { return ; } } } if ( ( this . pattern . simpleName ) == null ) { match . setOffset ( expr . sourceStart ) ; match . setLength ( ( ( ( expr . sourceEnd ) - ( expr . sourceStart ) ) + 1 ) ) ; } locator . report ( match ) ; } protected int referenceType ( ) { } protected void reportDeclaration ( ASTNode reference , IJavaElement element , MatchLocator locator , SimpleSet knownTypes ) throws CoreException { } protected void reportDeclaration ( ReferenceBinding typeBinding , int maxType , MatchLocator locator , SimpleSet knownTypes ) throws CoreException { } public int resolveLevel ( ASTNode node ) { } public int resolveLevel ( Binding binding ) { } protected int resolveLevel ( NameReference nameRef ) { } protected int resolveLevel ( TypeReference typeRef ) { } protected int resolveLevelForType ( TypeBinding typeBinding ) { } protected int resolveLevelForTypeOrEnclosingTypes ( char [ ] simpleNamePattern , char [ ] qualificationPattern , TypeBinding binding ) { } public String toString ( ) { } }

Fix:
LocalTypeBinding local = ( ( LocalTypeBinding ) ( refBinding . erasure ( ) ) ) ;