Program: 92180
Project: 92180
Buggy source:
/** 
 * Parses an enum declaration and returns the corresponding declaration.
 * @param _enum An ENUM node.
 * @return The corresponding enum declaration.
 * @throws ParseException
 */
private EnumDeclaration parseEnum(CommonTree _enum) throws ParseException {
  assert(_enum.getType() == CTFParser.ENUM);
  List<CommonTree> children=_enum.getChildren();
  assert(children != null);
  EnumDeclaration enumDeclaration=null;
  String enumName=null;
  CommonTree enumBody=null;
  IntegerDeclaration containerTypeDeclaration=null;
  for (  CommonTree child : children) {
switch (child.getType()) {
case CTFParser.ENUM_NAME:
{
        assert(enumName == null);
        assert(child.getChildCount() == 1);
        CommonTree enumNameIdentifier=(CommonTree)child.getChild(0);
        assert(enumNameIdentifier.getType() == CTFParser.IDENTIFIER);
        enumName=enumNameIdentifier.getText();
        break;
      }
case CTFParser.ENUM_BODY:
{
      assert(enumBody == null);
      enumBody=child;
      break;
    }
case CTFParser.ENUM_CONTAINER_TYPE:
{
    assert(containerTypeDeclaration == null);
    containerTypeDeclaration=parseEnumContainerType(child);
    break;
  }
default :
childTypeError(child);
break;
}
}
if (containerTypeDeclaration == null) {
IDeclaration decl=getCurrentScope().rlookupType("String_Node_Str");
if (decl == null) {
throw new ParseException("String_Node_Str");
}
 else if (!(decl instanceof IntegerDeclaration)) {
throw new ParseException("String_Node_Str");
}
containerTypeDeclaration=(IntegerDeclaration)decl;
}
if (enumBody != null) {
if ((enumName != null) && (getCurrentScope().lookupEnum(enumName) != null)) {
throw new ParseException("String_Node_Str" + enumName + "String_Node_Str");
}
enumDeclaration=new EnumDeclaration(containerTypeDeclaration);
parseEnumBody(enumBody,enumDeclaration);
if (enumName != null) {
getCurrentScope().registerEnum(enumName,enumDeclaration);
}
}
 else {
if (enumName != null) {
enumDeclaration=getCurrentScope().rlookupEnum(enumName);
if (enumDeclaration == null) {
throw new ParseException("String_Node_Str" + enumName + "String_Node_Str");
}
}
 else {
throw new ParseException("String_Node_Str");
}
}
return enumDeclaration;
}

Fixed version (ground truth):
/** 
 * Parses an enum declaration and returns the corresponding declaration.
 * @param _enum An ENUM node.
 * @return The corresponding enum declaration.
 * @throws ParseException
 */
private EnumDeclaration parseEnum(CommonTree _enum) throws ParseException {
  assert(_enum.getType() == CTFParser.ENUM);
  List<CommonTree> children=_enum.getChildren();
  assert(children != null);
  EnumDeclaration enumDeclaration=null;
  String enumName=null;
  CommonTree enumBody=null;
  IntegerDeclaration containerTypeDeclaration=null;
  for (  CommonTree child : children) {
switch (child.getType()) {
case CTFParser.ENUM_NAME:
{
        assert(enumName == null);
        assert(child.getChildCount() == 1);
        CommonTree enumNameIdentifier=(CommonTree)child.getChild(0);
        assert(enumNameIdentifier.getType() == CTFParser.IDENTIFIER);
        enumName=enumNameIdentifier.getText();
        break;
      }
case CTFParser.ENUM_BODY:
{
      assert(enumBody == null);
      enumBody=child;
      break;
    }
case CTFParser.ENUM_CONTAINER_TYPE:
{
    assert(containerTypeDeclaration == null);
    containerTypeDeclaration=parseEnumContainerType(child);
    break;
  }
default :
childTypeError(child);
break;
}
}
if (containerTypeDeclaration == null) {
IDeclaration enumDecl;
if (enumName != null) {
enumDecl=getCurrentScope().rlookupEnum(enumName);
if (enumDecl != null) {
return (EnumDeclaration)enumDecl;
}
}
IDeclaration decl=getCurrentScope().rlookupType("String_Node_Str");
if (decl == null) {
throw new ParseException("String_Node_Str");
}
 else if (!(decl instanceof IntegerDeclaration)) {
throw new ParseException("String_Node_Str");
}
containerTypeDeclaration=(IntegerDeclaration)decl;
}
if (enumBody != null) {
if ((enumName != null) && (getCurrentScope().lookupEnum(enumName) != null)) {
throw new ParseException("String_Node_Str" + enumName + "String_Node_Str");
}
enumDeclaration=new EnumDeclaration(containerTypeDeclaration);
parseEnumBody(enumBody,enumDeclaration);
if (enumName != null) {
getCurrentScope().registerEnum(enumName,enumDeclaration);
}
}
 else {
if (enumName != null) {
enumDeclaration=getCurrentScope().rlookupEnum(enumName);
if (enumDeclaration == null) {
throw new ParseException("String_Node_Str" + enumName + "String_Node_Str");
}
}
 else {
throw new ParseException("String_Node_Str");
}
}
return enumDeclaration;
}