Buggy code:
protected IType createTypeHandle ( String simpleTypeName ) { } protected boolean encloses ( IJavaElement element ) { } private long findLastTypeArgumentInfo ( TypeReference typeRef ) { } protected IBinaryType getBinaryInfo ( ClassFile classFile , IResource resource ) throws CoreException { } protected IType getFocusType ( ) { } protected void getMethodBodies ( CompilationUnitDeclaration unit , MatchingNodeSet nodeSet ) { } protected TypeBinding getType ( Object typeKey , char [ ] typeName ) { } public MethodBinding getMethodBinding ( MethodPattern methodPattern ) { } protected boolean hasAlreadyDefinedType ( CompilationUnitDeclaration parsedUnit ) { } public void initialize ( JavaProject project , int possibleMatchSize ) throws JavaModelException { } protected void locateMatches ( JavaProject javaProject , PossibleMatch [ ] possibleMatches , int start , int length ) throws CoreException { } protected void locateMatches ( JavaProject javaProject , PossibleMatchSet matchSet , int expected ) throws CoreException { } public void locateMatches ( SearchDocument [ ] searchDocuments ) throws CoreException { } protected void locatePackageDeclarations ( SearchParticipant participant , IJavaProject [ ] projects ) throws CoreException { } protected void locatePackageDeclarations ( SearchPattern searchPattern , SearchParticipant participant , IJavaProject [ ] projects ) throws CoreException { } protected IType lookupType ( ReferenceBinding typeBinding ) { } public SearchMatch newDeclarationMatch ( IJavaElement element , Binding binding , int accuracy , int offset , int length ) { } public SearchMatch newDeclarationMatch ( IJavaElement element , Binding binding , int accuracy , int offset , int length , SearchParticipant participant , IResource resource ) { } public FieldReferenceMatch newFieldReferenceMatch ( IJavaElement enclosingElement , IJavaElement localElement , Binding enclosingBinding , int accuracy , int offset , int length , ASTNode reference ) { } public SearchMatch newLocalVariableReferenceMatch ( IJavaElement enclosingElement , int accuracy , int offset , int length , ASTNode reference ) { } public MethodReferenceMatch newMethodReferenceMatch ( IJavaElement enclosingElement , Binding enclosingBinding , int accuracy , int offset , int length , boolean isConstructor , boolean isSynthetic , ASTNode reference ) { } public PackageReferenceMatch newPackageReferenceMatch ( IJavaElement enclosingElement , int accuracy , int offset , int length , ASTNode reference ) { } public SearchMatch newTypeParameterReferenceMatch ( IJavaElement enclosingElement , int accuracy , int offset , int length , ASTNode reference ) { } public TypeReferenceMatch newTypeReferenceMatch ( IJavaElement enclosingElement , Binding enclosingBinding , int accuracy , int offset , int length , ASTNode reference ) { } public TypeReferenceMatch newTypeReferenceMatch ( IJavaElement enclosingElement , Binding enclosingBinding , int accuracy , ASTNode reference ) { } protected boolean parseAndBuildBindings ( PossibleMatch possibleMatch , boolean mustResolve ) throws CoreException { } protected void process ( PossibleMatch possibleMatch , boolean bindingsWereCreated ) throws CoreException { } protected void purgeMethodStatements ( TypeDeclaration type , boolean checkEachMethod ) { } protected void reduceParseTree ( CompilationUnitDeclaration unit ) { } public SearchParticipant getParticipant ( ) { } protected void report ( SearchMatch match ) throws CoreException { } protected void reportAccurateTypeReference ( SearchMatch match , ASTNode typeRef , char [ ] name ) throws CoreException { } protected void reportAccurateParameterizedMethodReference ( SearchMatch match , ASTNode statement , TypeReference [ ] typeArguments ) throws CoreException { } protected void reportAccurateParameterizedTypeReference ( SearchMatch match , TypeReference typeRef , int index , TypeReference [ ] typeArguments ) throws CoreException { } protected void reportAccurateEnumConstructorReference ( SearchMatch match , FieldDeclaration field , AllocationExpression allocation ) throws CoreException { } protected void reportAccurateFieldReference ( SearchMatch [ ] matches , QualifiedNameReference qNameRef ) throws CoreException { } protected void reportBinaryMemberDeclaration ( IResource resource , IMember binaryMember , Binding binaryMemberBinding , IBinaryType info , int accuracy ) throws CoreException { } protected void reportMatching ( AbstractMethodDeclaration method , TypeDeclaration type , IJavaElement parent , int accuracy , boolean typeInHierarchy , MatchingNodeSet nodeSet ) throws CoreException { } protected void reportMatching ( Annotation [ ] annotations , IJavaElement enclosingElement , IJavaElement [ ] otherElements , Binding elementBinding , MatchingNodeSet nodeSet , boolean matchedContainer , boolean enclosesElement ) throws CoreException { for ( int i = 0 , al = annotations . length ; i < al ; i ++ ) { Annotation annotationType = annotations [ i ] ; IJavaElement localElement = null ; TypeReference typeRef = annotationType . type ; Integer level = ( ( Integer ) ( nodeSet . matchingNodes . removeKey ( typeRef ) ) ) ; <START_BUG> if ( ( level != null ) && matchedContainer ) { <END_BUG> localElement = createHandle ( annotationType , ( ( IAnnotatable ) ( enclosingElement ) ) ) ; this . patternLocator . matchReportReference ( typeRef , enclosingElement , localElement , otherElements , elementBinding , level . intValue ( ) , this ) ; } MemberValuePair [ ] pairs = annotationType . memberValuePairs ( ) ; for ( int j = 0 , pl = pairs . length ; j < pl ; j ++ ) { MemberValuePair pair = pairs [ j ] ; level = ( ( Integer ) ( nodeSet . matchingNodes . removeKey ( pair ) ) ) ; if ( ( level != null ) && enclosesElement ) { ASTNode reference = ( annotationType instanceof SingleMemberAnnotation ) ? ( ( ASTNode ) ( annotationType ) ) : pair ; if ( localElement == null ) { localElement = createHandle ( annotationType , ( ( IAnnotatable ) ( enclosingElement ) ) ) ; } this . patternLocator . matchReportReference ( reference , enclosingElement , localElement , otherElements , pair . binding , level . intValue ( ) , this ) ; } } ASTNode [ ] nodes = nodeSet . matchingNodes ( annotationType . sourceStart , annotationType . declarationSourceEnd ) ; if ( nodes != null ) { if ( ! matchedContainer ) { for ( int j = 0 , nl = nodes . length ; j < nl ; j ++ ) { nodeSet . matchingNodes . removeKey ( nodes [ j ] ) ; } } else { for ( int j = 0 , nl = nodes . length ; j < nl ;

Fix:
if ( ( ( level != null ) && enclosesElement ) && matchedContainer ) {