Program: 185647
Project: 185647
Buggy source:
protected void enumConstantDef(AST node){
  enumConstantBeingDef=true;
  assertNodeType(ENUM_CONSTANT_DEF,node);
  List<AnnotationNode> annotations=new ArrayList<AnnotationNode>();
  AST element=node.getFirstChild();
  if (isType(ANNOTATIONS,element)) {
    processAnnotations(annotations,element);
    element=element.getNextSibling();
  }
  String identifier=identifier(element);
  int savedLine=element.getLine();
  int savedColumn=element.getColumn();
  Expression init=null;
  element=element.getNextSibling();
  if (element != null) {
    init=expression(element);
    ClassNode innerClass;
    if (element.getNextSibling() == null) {
      innerClass=getAnonymousInnerClassNode(init);
      if (innerClass != null) {
        init=null;
      }
    }
 else {
      element=element.getNextSibling();
      Expression next=expression(element);
      innerClass=getAnonymousInnerClassNode(next);
    }
    if (innerClass != null) {
      innerClass.setSuperClass(classNode.getPlainNodeReference());
      innerClass.setModifiers(classNode.getModifiers() | Opcodes.ACC_FINAL);
      Expression inner=new ClassExpression(innerClass);
      if (init == null) {
        ListExpression le=new ListExpression();
        le.addExpression(inner);
        init=le;
      }
 else {
        if (init instanceof ListExpression) {
          ((ListExpression)init).addExpression(inner);
        }
 else {
          ListExpression le=new ListExpression();
          le.addExpression(init);
          le.addExpression(inner);
          init=le;
        }
      }
      classNode.setModifiers(classNode.getModifiers() & ~Opcodes.ACC_FINAL);
    }
 else     if (isType(ELIST,element)) {
      if (init instanceof ListExpression && !((ListExpression)init).isWrapped()) {
        ListExpression le=new ListExpression();
        le.addExpression(init);
        init=le;
      }
    }
  }
  GroovySourceAST groovySourceAST=(GroovySourceAST)node;
  int nameStart=locations.findOffset(groovySourceAST.getLine(),groovySourceAST.getColumn());
  int nameEnd=nameStart + identifier.length() - 1;
  ClassNode fakeNodeToRepresentTheNonDeclaredTypeOfEnumValue=ClassHelper.make(classNode.getName());
  fakeNodeToRepresentTheNonDeclaredTypeOfEnumValue.setRedirect(classNode);
  FieldNode fn=EnumHelper.addEnumConstant(fakeNodeToRepresentTheNonDeclaredTypeOfEnumValue,classNode,identifier,init,savedLine,savedColumn);
  configureAST(fn,node);
  fn.setNameStart(nameStart);
  fn.setNameEnd(nameEnd);
  fn.setStart(nameStart);
  fn.setEnd(nameEnd);
  enumConstantBeingDef=false;
}

Fixed version (ground truth):
protected void enumConstantDef(AST node){
  enumConstantBeingDef=true;
  assertNodeType(ENUM_CONSTANT_DEF,node);
  List<AnnotationNode> annotations=new ArrayList<AnnotationNode>();
  AST element=node.getFirstChild();
  if (isType(ANNOTATIONS,element)) {
    processAnnotations(annotations,element);
    element=element.getNextSibling();
  }
  String identifier=identifier(element);
  int savedLine=element.getLine();
  int savedColumn=element.getColumn();
  Expression init=null;
  element=element.getNextSibling();
  if (element != null) {
    init=expression(element);
    ClassNode innerClass;
    if (element.getNextSibling() == null) {
      innerClass=getAnonymousInnerClassNode(init);
      if (innerClass != null) {
        init=null;
      }
    }
 else {
      element=element.getNextSibling();
      Expression next=expression(element);
      innerClass=getAnonymousInnerClassNode(next);
    }
    if (innerClass != null) {
      innerClass.setSuperClass(classNode.getPlainNodeReference());
      innerClass.setModifiers(classNode.getModifiers() | Opcodes.ACC_FINAL);
      Expression inner=new ClassExpression(innerClass);
      if (init == null) {
        ListExpression le=new ListExpression();
        le.addExpression(inner);
        init=le;
      }
 else {
        if (init instanceof ListExpression) {
          ((ListExpression)init).addExpression(inner);
        }
 else {
          ListExpression le=new ListExpression();
          le.addExpression(init);
          le.addExpression(inner);
          init=le;
        }
      }
      classNode.setModifiers(classNode.getModifiers() & ~Opcodes.ACC_FINAL);
    }
 else     if (isType(ELIST,element)) {
      if (init instanceof ListExpression && !((ListExpression)init).isWrapped()) {
        ListExpression le=new ListExpression();
        le.addExpression(init);
        init=le;
      }
    }
  }
  ClassNode nonDeclaredTypeOfEnumValue=ClassHelper.make(classNode.getName());
  nonDeclaredTypeOfEnumValue.setRedirect(classNode);
  FieldNode enumField=EnumHelper.addEnumConstant(nonDeclaredTypeOfEnumValue,classNode,identifier,init,savedLine,savedColumn);
  enumField.setNameStart(locations.findOffset(savedLine,savedColumn));
  enumField.setNameEnd(enumField.getNameStart() + identifier.length() - 1);
  enumField.addAnnotations(annotations);
  configureAST(enumField,node);
  enumConstantBeingDef=false;
}