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 { MethodBinding methodBinding = ( reference instanceof MessageSend ) ? ( ( MessageSend ) ( reference ) ) . binding : elementBinding instanceof MethodBinding ? ( ( MethodBinding ) ( elementBinding ) ) : null ; if ( this . isDeclarationOfReferencedMethodsPattern ) { if ( methodBinding == null ) return ; if ( accuracy != ( SearchMatch . A_ACCURATE ) ) return ; DeclarationOfReferencedMethodsPattern declPattern = ( ( DeclarationOfReferencedMethodsPattern ) ( this . pattern ) ) ; while ( ( element != null ) && ( ! ( declPattern . enclosingElement . equals ( element ) ) ) ) element = element . getParent ( ) ; if ( element != null ) { reportDeclaration ( methodBinding , locator , declPattern . knownMethods ) ; } } else { match = locator . newMethodReferenceMatch ( element , elementBinding , accuracy , ( - 1 ) , ( - 1 ) , false , false , reference ) ; if ( ( this . pattern . findReferences ) && ( reference instanceof MessageSend ) ) { IJavaElement focus = ( ( InternalSearchPattern ) ( this . pattern ) ) . focus ; if ( ( focus != null ) && ( ( focus . getElementType ( ) ) == ( IJavaElement . METHOD ) ) ) { <START_BUG> if ( methodBinding != null ) { <END_BUG> boolean isPrivate = Flags . isPrivate ( ( ( IMethod ) ( focus ) ) . getFlags ( ) ) ; if ( isPrivate && ( ! ( CharOperation . equals ( methodBinding . declaringClass . sourceName , focus . getParent ( ) . getElementName ( ) . toCharArray ( ) ) ) ) ) { return ; } } } matchReportReference ( ( ( MessageSend ) ( reference ) ) , locator , ( ( MessageSend ) ( reference ) ) . binding ) ; } else { if ( reference instanceof SingleMemberAnnotation ) { reference = ( ( SingleMemberAnnotation ) ( reference ) ) . memberValuePairs ( ) [ 0 ] ; match . setImplicit ( true ) ; } int offset = reference . sourceStart ; int length = ( ( reference . sourceEnd ) - offset ) + 1 ; match . setOffset ( offset ) ; match . setLength ( length ) ; locator . report ( match ) ; } } } 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 { } 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:
if ( ( methodBinding != null ) && ( ( methodBinding . declaringClass ) != null ) ) {