Program: 185426
Project: 185426
Buggy source:
@Override public VisitStatus acceptASTNode(ASTNode node,TypeLookupResult result,IJavaElement enclosingElement){
  if (result.declaringType == null) {
    return VisitStatus.CONTINUE;
  }
  boolean isDeclaration=(node instanceof MethodNode);
  int start=0;
  int end=0;
  if (result.declaration instanceof MethodNode) {
    if (methodName.equals(((MethodNode)result.declaration).getName())) {
      if (isDeclaration || node instanceof StaticMethodCallExpression) {
        start=((AnnotatedNode)node).getNameStart();
        end=((AnnotatedNode)node).getNameEnd() + 1;
      }
 else {
        String text=node.getText();
        if (methodName.equals(text) || result.declaringType.getField(text) != null) {
          start=node.getStart();
          end=node.getEnd();
        }
      }
    }
  }
  if (end > 0) {
    Position position=new Position(start,end - start);
    if (!acceptedPositions.contains(position)) {
      if (nameAndArgsMatch(GroovyUtils.getBaseType(result.declaringType),isDeclaration ? GroovyUtils.getParameterTypes(((MethodNode)node).getParameters()) : result.scope.getMethodCallArgumentTypes())) {
        if (enclosingElement.getOpenable() instanceof GroovyClassFileWorkingCopy) {
          enclosingElement=((GroovyClassFileWorkingCopy)enclosingElement.getOpenable()).convertToBinary(enclosingElement);
        }
        SearchMatch match=null;
        if (isDeclaration && findDeclarations) {
          match=new MethodDeclarationMatch(enclosingElement,getAccuracy(result.confidence),start,end - start,participant,enclosingElement.getResource());
        }
 else         if (!isDeclaration && findReferences) {
          match=new MethodReferenceMatch(enclosingElement,getAccuracy(result.confidence),start,end - start,false,false,false,false,participant,enclosingElement.getResource());
        }
        if (match != null) {
          try {
            acceptedPositions.add(position);
            requestor.acceptSearchMatch(match);
          }
 catch (          Exception e) {
            Util.log(e,"String_Node_Str" + enclosingElement + "String_Node_Str"+ enclosingElement.getResource());
          }
        }
      }
    }
  }
  return VisitStatus.CONTINUE;
}

Fixed version (ground truth):
@Override public VisitStatus acceptASTNode(ASTNode node,TypeLookupResult result,IJavaElement enclosingElement){
  if (result.declaringType == null) {
    return VisitStatus.CONTINUE;
  }
  boolean isDeclaration=(node instanceof MethodNode);
  int start=0;
  int end=0;
  if (result.declaration instanceof MethodNode && ((MethodNode)result.declaration).getName().equals(methodName)) {
    if (isDeclaration || node instanceof StaticMethodCallExpression) {
      start=((AnnotatedNode)node).getNameStart();
      end=((AnnotatedNode)node).getNameEnd() + 1;
    }
 else     if (node.getText().equals(methodName) || isNotSynthetic(node.getText(),result.declaringType)) {
      start=node.getStart();
      end=node.getEnd();
    }
  }
  if (end > 0) {
    Position position=new Position(start,end - start);
    if (!acceptedPositions.contains(position)) {
      if (nameAndArgsMatch(GroovyUtils.getBaseType(result.declaringType),isDeclaration ? GroovyUtils.getParameterTypes(((MethodNode)node).getParameters()) : result.scope.getMethodCallArgumentTypes())) {
        if (enclosingElement.getOpenable() instanceof GroovyClassFileWorkingCopy) {
          enclosingElement=((GroovyClassFileWorkingCopy)enclosingElement.getOpenable()).convertToBinary(enclosingElement);
        }
        SearchMatch match=null;
        if (isDeclaration && findDeclarations) {
          match=new MethodDeclarationMatch(enclosingElement,getAccuracy(result.confidence),start,end - start,participant,enclosingElement.getResource());
        }
 else         if (!isDeclaration && findReferences) {
          match=new MethodReferenceMatch(enclosingElement,getAccuracy(result.confidence),start,end - start,false,false,false,false,participant,enclosingElement.getResource());
        }
        if (match != null) {
          try {
            acceptedPositions.add(position);
            requestor.acceptSearchMatch(match);
          }
 catch (          Exception e) {
            Util.log(e,"String_Node_Str" + enclosingElement + "String_Node_Str"+ enclosingElement.getResource());
          }
        }
      }
    }
  }
  return VisitStatus.CONTINUE;
}