Buggy code:
public class MethodLocator extends PatternLocator { protected MethodPattern pattern ; protected boolean isDeclarationOfReferencedMethodsPattern ; public char [ ] [ ] [ ] allSuperDeclaringTypeNames ; private HashMap methodDeclarationsWithInvalidParam = new HashMap ( ) ; public MethodLocator ( MethodPattern pattern ) { } protected void clear ( ) { } public void initializePolymorphicSearch ( MatchLocator locator ) { } private boolean isTypeInSuperDeclaringTypeNames ( char [ ] [ ] typeName ) { } protected boolean isVirtualInvoke ( MethodBinding method , MessageSend messageSend ) { } public int match ( ASTNode node , MatchingNodeSet nodeSet ) { } public int match ( MethodDeclaration node , MatchingNodeSet nodeSet ) { } public int match ( MemberValuePair node , MatchingNodeSet nodeSet ) { } public int match ( MessageSend node , MatchingNodeSet nodeSet ) { } public int match ( Annotation node , MatchingNodeSet nodeSet ) { } protected int matchContainer ( ) { } protected void matchLevelAndReportImportRef ( ImportReference importRef , Binding binding , MatchLocator locator ) throws CoreException { } protected int matchMethod ( MethodBinding method , boolean skipImpossibleArg ) { } private boolean matchOverriddenMethod ( ReferenceBinding type , MethodBinding method , MethodBinding matchMethod ) { } protected void matchReportReference ( ASTNode reference , IJavaElement element , Binding elementBinding , int accuracy , MatchLocator locator ) throws CoreException { } void matchReportReference ( MessageSend messageSend , MatchLocator locator , MethodBinding methodBinding ) throws CoreException { } private boolean methodParametersEqualsPattern ( MethodBinding method ) { } public SearchMatch newDeclarationMatch ( ASTNode reference , IJavaElement element , Binding elementBinding , int accuracy , int length , MatchLocator locator ) { } protected int referenceType ( ) { } protected void reportDeclaration ( MethodBinding methodBinding , MatchLocator locator , SimpleSet knownMethods ) throws CoreException { ReferenceBinding declaringClass = methodBinding . declaringClass ; IType type = locator . lookupType ( declaringClass ) ; if ( type == null ) return ; char [ ] bindingSelector = methodBinding . selector ; boolean isBinary = type . isBinary ( ) ; IMethod method = null ; TypeBinding [ ] parameters = methodBinding . original ( ) . parameters ; int parameterLength = parameters . length ; if ( isBinary ) { char [ ] [ ] parameterTypes = new char [ parameterLength ] [ ] ; for ( int i = 0 ; i < parameterLength ; i ++ ) { char [ ] typeName = parameters [ i ] . qualifiedSourceName ( ) ; for ( int j = 0 , dim = parameters [ i ] . dimensions ( ) ; j < dim ; j ++ ) { typeName = CharOperation . concat ( typeName , new char [ ] { '[' , ']' } ) ; } parameterTypes [ i ] = typeName ; } method = locator . createBinaryMethodHandle ( type , methodBinding . selector , parameterTypes ) ; } else { String [ ] parameterTypes = new String [ parameterLength ] ; for ( int i = 0 ; i < parameterLength ; i ++ ) { char [ ] typeName = parameters [ i ] . shortReadableName ( ) ; if ( parameters [ i ] . isMemberType ( ) ) { typeName = CharOperation . subarray ( typeName , ( ( CharOperation . indexOf ( '.' , typeName ) ) + 1 ) , typeName . length ) ; } parameterTypes [ i ] = Signature . createTypeSignature ( typeName , false ) ; } method = type . getMethod ( new String ( bindingSelector ) , parameterTypes ) ; } if ( ( method == null ) || ( ( knownMethods . addIfNotIncluded ( method ) ) == null ) ) return ; IResource resource = type . getResource ( ) ; IBinaryType info = null ; if ( isBinary ) { if ( resource == null ) resource = type . getJavaProject ( ) . getProject ( ) ; info = locator . getBinaryInfo ( ( ( ClassFile ) ( type . getClassFile ( ) ) ) , resource ) ; locator . reportBinaryMemberDeclaration ( resource , method , methodBinding , info , SearchMatch . A_ACCURATE ) ; } else { if ( declaringClass instanceof ParameterizedTypeBinding ) <START_BUG> declaringClass = ( ( ParameterizedTypeBinding ) ( declaringClass ) ) . type ; <END_BUG> ClassScope scope = ( ( SourceTypeBinding ) ( declaringClass ) ) . scope ; if ( scope != null ) { TypeDeclaration typeDecl = scope . referenceContext ; AbstractMethodDeclaration methodDecl = null ; AbstractMethodDeclaration [ ] methodDecls = typeDecl . methods ; for ( int i = 0 , length = methodDecls . length ; i < length ; i ++ ) { if ( CharOperation . equals ( bindingSelector , methodDecls [ i ] . selector ) ) { methodDecl = methodDecls [ i ] ; break ; } } if ( methodDecl != null ) { int offset = methodDecl . sourceStart ; Binding binding = methodDecl . binding ; if ( binding != null ) method = ( ( IMethod ) ( ( ( JavaElement ) ( method ) ) . resolved ( binding ) ) ) ; match = new MethodDeclarationMatch ( method , SearchMatch . A_ACCURATE , offset , ( ( ( methodDecl . sourceEnd ) - offset ) + 1 ) , locator . getParticipant ( ) , resource ) ; locator . report ( match ) ; } } } } public int resolveLevel ( ASTNode possibleMatchingNode ) { } public int resolveLevel ( Binding binding ) { } protected int resolveLevel ( MessageSend messageSend ) { } protected int resolveLevelAsSubtype ( char [ ] qualifiedPattern , ReferenceBinding type , TypeBinding [ ] argumentTypes ) { } public String toString ( ) { } }

Fix:
declaringClass = ( ( ParameterizedTypeBinding ) ( declaringClass ) ) . genericType ( ) ;