Program: 185427
Project: 185427
Buggy source:
@Override public VisitStatus acceptASTNode(ASTNode node,TypeLookupResult result,IJavaElement enclosingElement){
  boolean doCheck=false;
  boolean isAssignment=false;
  boolean isDeclaration=false;
  int start=0;
  int end=0;
  if (node instanceof ConstantExpression) {
    String cName=((ConstantExpression)node).getText();
    if (cName != null && CharOperation.equals(name,cName.toCharArray())) {
      doCheck=true;
      if (EqualityVisitor.checkForAssignment(node,result.enclosingAssignment)) {
        isAssignment=true;
      }
      start=node.getStart();
      end=node.getEnd();
    }
  }
 else   if (node instanceof FieldExpression) {
    if (CharOperation.equals(name,((FieldExpression)node).getFieldName().toCharArray())) {
      doCheck=true;
      if (EqualityVisitor.checkForAssignment(node,result.enclosingAssignment)) {
        isAssignment=true;
      }
      end=node.getEnd();
      start=end - name.length;
    }
  }
 else   if (node instanceof FieldNode) {
    FieldNode fnode=(FieldNode)node;
    if (CharOperation.equals(name,fnode.getName().toCharArray())) {
      doCheck=true;
      isDeclaration=true;
      isAssignment=true;
      start=fnode.getNameStart();
      end=fnode.getNameEnd() + 1;
    }
  }
 else   if (node instanceof VariableExpression) {
    VariableExpression vnode=(VariableExpression)node;
    if (CharOperation.equals(name,vnode.getName().toCharArray())) {
      doCheck=true;
      if (EqualityVisitor.checkForAssignment(node,result.enclosingAssignment)) {
        isAssignment=true;
      }
      start=vnode.getStart();
      end=start + vnode.getName().length();
    }
  }
  if (doCheck && end > 0 && result.declaringType != null) {
    Position position=new Position(start,end - start);
    if (!acceptedPositions.contains(position)) {
      boolean isCompleteMatch=qualifiedNameMatches(GroovyUtils.getBaseType(result.declaringType));
      if (isCompleteMatch && ((isAssignment && writeAccess) || (!isAssignment && readAccess) || (isDeclaration && findDeclarations))) {
        SearchMatch match=null;
        IJavaElement realElement=enclosingElement.getOpenable() instanceof GroovyClassFileWorkingCopy ? ((GroovyClassFileWorkingCopy)enclosingElement.getOpenable()).convertToBinary(enclosingElement) : enclosingElement;
        if (isDeclaration && findDeclarations) {
          match=new FieldDeclarationMatch(realElement,getAccuracy(result.confidence,isCompleteMatch),start,end - start,participant,realElement.getResource());
        }
 else         if (!isDeclaration && findReferences) {
          match=new FieldReferenceMatch(realElement,getAccuracy(result.confidence,isCompleteMatch),start,end - start,!isAssignment,isAssignment,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):
@Override public VisitStatus acceptASTNode(ASTNode node,TypeLookupResult result,IJavaElement enclosingElement){
  boolean doCheck=false;
  boolean isAssignment=false;
  boolean isDeclaration=false;
  int start=0;
  int end=0;
  if (node instanceof ConstantExpression) {
    if (fieldName.equals(((ConstantExpression)node).getText()) && (result.confidence == TypeConfidence.UNKNOWN || result.declaringType.getField(fieldName) != null || result.declaringType.getProperty(fieldName) != null)) {
      doCheck=true;
      isAssignment=EqualityVisitor.checkForAssignment(node,result.enclosingAssignment);
      start=node.getStart();
      end=node.getEnd();
    }
  }
 else   if (node instanceof FieldExpression) {
    if (fieldName.equals(((FieldExpression)node).getFieldName())) {
      doCheck=true;
      isAssignment=EqualityVisitor.checkForAssignment(node,result.enclosingAssignment);
      start=end - fieldName.length();
      end=node.getEnd();
    }
  }
 else   if (node instanceof FieldNode) {
    FieldNode fnode=(FieldNode)node;
    if (fieldName.equals(fnode.getName())) {
      doCheck=true;
      isAssignment=true;
      isDeclaration=true;
      start=fnode.getNameStart();
      end=fnode.getNameEnd() + 1;
    }
  }
 else   if (node instanceof VariableExpression) {
    String vname=((VariableExpression)node).getName();
    if (fieldName.equals(vname)) {
      doCheck=true;
      isAssignment=EqualityVisitor.checkForAssignment(node,result.enclosingAssignment);
      start=node.getStart();
      end=start + vname.length();
    }
  }
  if (doCheck && end > 0 && result.declaringType != null) {
    Position position=new Position(start,end - start);
    if (!acceptedPositions.contains(position)) {
      boolean isCompleteMatch=qualifiedNameMatches(GroovyUtils.getBaseType(result.declaringType));
      if (isCompleteMatch && ((isAssignment && writeAccess) || (!isAssignment && readAccess) || (isDeclaration && findDeclarations))) {
        SearchMatch match=null;
        IJavaElement realElement=enclosingElement.getOpenable() instanceof GroovyClassFileWorkingCopy ? ((GroovyClassFileWorkingCopy)enclosingElement.getOpenable()).convertToBinary(enclosingElement) : enclosingElement;
        if (isDeclaration && findDeclarations) {
          match=new FieldDeclarationMatch(realElement,getAccuracy(result.confidence,isCompleteMatch),start,end - start,participant,realElement.getResource());
        }
 else         if (!isDeclaration && findReferences) {
          match=new FieldReferenceMatch(realElement,getAccuracy(result.confidence,isCompleteMatch),start,end - start,!isAssignment,isAssignment,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;
}