Program: 185566
Project: 185566
Buggy source:
public VisitStatus acceptASTNode(ASTNode node,TypeLookupResult result,IJavaElement enclosingElement){
  boolean doCheck=false;
  boolean isDeclaration=false;
  boolean isConstructorCall=false;
  int start=0;
  int end=0;
  if (result.declaringType == null) {
    return VisitStatus.CONTINUE;
  }
  if (node instanceof ConstantExpression) {
    String cName=((ConstantExpression)node).getText();
    if (cName != null && CharOperation.equals(name,cName.toCharArray())) {
      start=node.getStart();
      end=node.getEnd();
      doCheck=end > 0;
    }
  }
 else   if (node instanceof FieldExpression) {
    if (CharOperation.equals(name,((FieldExpression)node).getFieldName().toCharArray())) {
      start=node.getStart();
      end=node.getEnd();
      doCheck=end > 0;
    }
  }
 else   if (node instanceof MethodNode) {
    MethodNode mnode=(MethodNode)node;
    if (CharOperation.equals(name,mnode.getName().toCharArray())) {
      isDeclaration=true;
      start=mnode.getNameStart();
      end=mnode.getNameEnd() + 1;
      doCheck=true;
    }
  }
 else   if (node instanceof VariableExpression) {
    VariableExpression vnode=(VariableExpression)node;
    if (CharOperation.equals(name,vnode.getName().toCharArray())) {
      start=vnode.getStart();
      end=start + vnode.getName().length();
      doCheck=true;
    }
  }
 else   if (node instanceof StaticMethodCallExpression) {
    StaticMethodCallExpression smnode=(StaticMethodCallExpression)node;
    if (CharOperation.equals(name,smnode.getMethod().toCharArray())) {
      start=smnode.getStart();
      end=start + name.length;
      doCheck=true;
    }
  }
  if (doCheck && end > 0) {
    Position position=new Position(start,end - start);
    if (!acceptedPositions.contains(position)) {
      int numberOfParameters=findNumberOfParameters(node,result);
      boolean isCompleteMatch=nameAndArgsMatch(GroovyUtils.getBaseType(result.declaringType),numberOfParameters);
      if (isCompleteMatch) {
        IJavaElement realElement=enclosingElement.getOpenable() instanceof GroovyClassFileWorkingCopy ? ((GroovyClassFileWorkingCopy)enclosingElement.getOpenable()).convertToBinary(enclosingElement) : enclosingElement;
        SearchMatch match=null;
        if (isDeclaration && findDeclarations) {
          match=new MethodDeclarationMatch(realElement,getAccuracy(result.confidence,isCompleteMatch),start,end - start,participant,realElement.getResource());
        }
 else         if (!isDeclaration && findReferences) {
          match=new MethodReferenceMatch(realElement,getAccuracy(result.confidence,isCompleteMatch),start,end - start,isConstructorCall,false,false,false,participant,realElement.getResource());
        }
        if (match != null) {
          try {
            requestor.acceptSearchMatch(match);
            acceptedPositions.add(position);
          }
 catch (          CoreException e) {
            Util.log(e,"String_Node_Str" + realElement + "String_Node_Str"+ realElement.getResource());
          }
        }
      }
    }
  }
  return VisitStatus.CONTINUE;
}

Fixed version (ground truth):
public VisitStatus acceptASTNode(ASTNode node,TypeLookupResult result,IJavaElement enclosingElement){
  if (result.declaringType == null) {
    return VisitStatus.CONTINUE;
  }
  boolean doCheck=false;
  boolean isDeclaration=false;
  boolean isConstructorCall=false;
  int start=0;
  int end=0;
  if (node instanceof ConstantExpression) {
    String cName=((ConstantExpression)node).getText();
    if (name.equals(cName)) {
      start=node.getStart();
      end=node.getEnd();
      doCheck=end > 0;
    }
  }
 else   if (node instanceof FieldExpression) {
    if (name.equals(((FieldExpression)node).getFieldName())) {
      start=node.getStart();
      end=node.getEnd();
      doCheck=end > 0;
    }
  }
 else   if (node instanceof MethodNode) {
    MethodNode mnode=(MethodNode)node;
    if (name.equals(mnode.getName())) {
      isDeclaration=true;
      start=mnode.getNameStart();
      end=mnode.getNameEnd() + 1;
      doCheck=true;
    }
  }
 else   if (node instanceof VariableExpression) {
    VariableExpression vnode=(VariableExpression)node;
    if (name.equals(vnode.getName())) {
      start=vnode.getStart();
      end=start + vnode.getName().length();
      doCheck=true;
    }
  }
 else   if (node instanceof StaticMethodCallExpression) {
    StaticMethodCallExpression smnode=(StaticMethodCallExpression)node;
    if (name.equals(smnode.getMethod())) {
      start=smnode.getStart();
      end=start + name.length();
      doCheck=true;
    }
  }
  if (doCheck && end > 0) {
    Position position=new Position(start,end - start);
    if (!acceptedPositions.contains(position)) {
      int numberOfParameters=findNumberOfParameters(node,result);
      boolean isCompleteMatch=nameAndArgsMatch(GroovyUtils.getBaseType(result.declaringType),numberOfParameters);
      if (isCompleteMatch) {
        IJavaElement realElement=enclosingElement.getOpenable() instanceof GroovyClassFileWorkingCopy ? ((GroovyClassFileWorkingCopy)enclosingElement.getOpenable()).convertToBinary(enclosingElement) : enclosingElement;
        SearchMatch match=null;
        if (isDeclaration && findDeclarations) {
          match=new MethodDeclarationMatch(realElement,getAccuracy(result.confidence,isCompleteMatch),start,end - start,participant,realElement.getResource());
        }
 else         if (!isDeclaration && findReferences) {
          match=new MethodReferenceMatch(realElement,getAccuracy(result.confidence,isCompleteMatch),start,end - start,isConstructorCall,false,false,false,participant,realElement.getResource());
        }
        if (match != null) {
          try {
            requestor.acceptSearchMatch(match);
            acceptedPositions.add(position);
          }
 catch (          CoreException e) {
            Util.log(e,"String_Node_Str" + realElement + "String_Node_Str"+ realElement.getResource());
          }
        }
      }
    }
  }
  return VisitStatus.CONTINUE;
}