Program: 28292
Project: 28292
Buggy source:
boolean function(Context context,DeclarationList declList) throws ParserException {
  int backIndex=tokens.index;
  String spacing=tokens.get().spacing;
  String modifiers="String_Node_Str";
  int startIndex=tokens.index;
  Type type=type(context);
  Parameters params=parameters(context,0,false);
  Declarator dcl=new Declarator();
  Declaration decl=new Declaration();
  if (type.javaName.length() == 0) {
    tokens.index=backIndex;
    return false;
  }
 else   if (context.javaName == null && !type.operator && params != null) {
    if (tokens.get().match(':')) {
      for (Token token=tokens.next(); !token.match(Token.EOF); token=tokens.next()) {
        if (token.match('{',';')) {
          break;
        }
      }
    }
    if (tokens.get().match('{')) {
      body();
    }
 else {
      tokens.next();
    }
    decl.text=spacing;
    declList.add(decl);
    return true;
  }
 else   if ((type.constructor || type.destructor || type.operator) && params != null) {
    dcl.type=type;
    dcl.parameters=params;
    dcl.cppName=type.cppName;
    dcl.javaName=type.javaName.substring(type.javaName.lastIndexOf(' ') + 1);
    if (type.operator) {
      dcl.cppName="String_Node_Str" + dcl.cppName;
      dcl.javaName="String_Node_Str" + Character.toUpperCase(dcl.javaName.charAt(0)) + dcl.javaName.substring(1);
    }
    dcl.signature=dcl.javaName + params.signature;
  }
 else {
    tokens.index=startIndex;
    dcl=declarator(context,null,0,false,0,false,false);
    type=dcl.type;
  }
  if (dcl.cppName == null || type.javaName.length() == 0 || dcl.parameters == null) {
    tokens.index=backIndex;
    return false;
  }
  int namespace=dcl.cppName.lastIndexOf("String_Node_Str");
  if (context.namespace != null && namespace < 0) {
    dcl.cppName=context.namespace + "String_Node_Str" + dcl.cppName;
  }
  Info info=null;
  if (dcl.parameters != null) {
    String name=dcl.cppName + "String_Node_Str", separator="String_Node_Str";
    for (    Declarator d : dcl.parameters.declarators) {
      if (d != null) {
        name+=separator + d.type.cppName;
        for (int i=0; i < d.indirections; i++) {
          name+="String_Node_Str";
        }
        if (d.reference) {
          name+="String_Node_Str";
        }
        separator="String_Node_Str";
      }
    }
    info=infoMap.getFirst(name+="String_Node_Str");
    if (info == null && !type.constructor && !type.destructor && !type.operator) {
      infoMap.put(new Info(name));
    }
  }
  if (info == null) {
    info=infoMap.getFirst(dcl.cppName);
  }
  String localName=dcl.cppName;
  if (localName.startsWith(context.namespace + "String_Node_Str")) {
    localName=dcl.cppName.substring(context.namespace.length() + 2);
  }
  if (type.friend || (context.javaName == null && localName.contains("String_Node_Str")) || (info != null && info.skip)) {
    for (Token token=tokens.get(); !token.match(Token.EOF); token=tokens.get()) {
      if (attribute() == null) {
        break;
      }
    }
    if (tokens.get().match(':')) {
      for (Token token=tokens.next(); !token.match(Token.EOF); token=tokens.next()) {
        if (token.match('{',';')) {
          break;
        }
      }
    }
    if (tokens.get().match('{')) {
      body();
    }
 else {
      tokens.next();
    }
    decl.text=spacing;
    declList.add(decl);
    return true;
  }
 else   if (type.staticMember || context.javaName == null) {
    modifiers="String_Node_Str";
  }
  LinkedList<Declarator> prevDcl=new LinkedList<Declarator>();
  boolean first=true;
  for (int n=-2; n < Integer.MAX_VALUE; n++) {
    decl=new Declaration();
    tokens.index=startIndex;
    if (type.constructor || type.destructor || type.operator) {
      type=type(context);
      params=parameters(context,n / 2,n % 2 != 0);
      dcl=new Declarator();
      dcl.type=type;
      dcl.parameters=params;
      dcl.cppName=type.cppName;
      dcl.javaName=type.javaName.substring(type.javaName.lastIndexOf(' ') + 1);
      if (type.operator) {
        dcl.cppName="String_Node_Str" + dcl.cppName;
        dcl.javaName="String_Node_Str" + Character.toUpperCase(dcl.javaName.charAt(0)) + dcl.javaName.substring(1);
      }
      dcl.signature=dcl.javaName + params.signature;
      if (tokens.get().match(':')) {
        for (Token token=tokens.next(); !token.match(Token.EOF); token=tokens.next()) {
          if (token.match('{',';')) {
            break;
          }
        }
      }
    }
 else {
      dcl=declarator(context,null,n / 2,n % 2 != 0,0,false,false);
      type=dcl.type;
      namespace=dcl.cppName.lastIndexOf("String_Node_Str");
      if (context.namespace != null && namespace < 0) {
        dcl.cppName=context.namespace + "String_Node_Str" + dcl.cppName;
      }
    }
    for (Token token=tokens.get(); !token.match(Token.EOF); token=tokens.get()) {
      decl.constMember|=token.match(Token.CONST);
      if (attribute() == null) {
        break;
      }
    }
    if (tokens.get().match('{')) {
      body();
    }
 else {
      if (tokens.get().match('=')) {
        tokens.next().expect("String_Node_Str");
        tokens.next().expect(';');
        decl.abstractMember=true;
      }
      tokens.next();
    }
    if (type.virtual && context.virtualize) {
      modifiers=context.inaccessible ? "String_Node_Str" : "String_Node_Str";
    }
    decl.declarator=dcl;
    if (context.namespace != null && context.javaName == null) {
      decl.text+="String_Node_Str" + context.namespace + "String_Node_Str";
    }
    if (type.constructor && params != null) {
      decl.text+="String_Node_Str" + context.shorten(context.javaName) + dcl.parameters.list+ "String_Node_Str"+ params.names+ "String_Node_Str"+ "String_Node_Str"+ dcl.parameters.list+ "String_Node_Str";
    }
 else {
      decl.text+=modifiers + type.annotations + type.javaName+ "String_Node_Str"+ dcl.javaName+ dcl.parameters.list+ "String_Node_Str";
    }
    decl.signature=dcl.signature;
    if (info != null && info.javaText != null) {
      if (first) {
        decl.text=info.javaText;
      }
 else {
        break;
      }
    }
    String comment=commentAfter();
    if (first) {
      first=false;
      declList.spacing=spacing;
      decl.text=comment + decl.text;
    }
    boolean found=false;
    for (    Declarator d : prevDcl) {
      found|=dcl.signature.equals(d.signature);
    }
    if (dcl.javaName.length() > 0 && !found && !type.destructor) {
      declList.add(decl);
      if (type.virtual && context.virtualize) {
        break;
      }
    }
 else     if (found && n / 2 > 0 && n % 2 == 0) {
      break;
    }
    prevDcl.add(dcl);
  }
  declList.spacing=null;
  return true;
}

Fixed version (ground truth):
boolean function(Context context,DeclarationList declList) throws ParserException {
  int backIndex=tokens.index;
  String spacing=tokens.get().spacing;
  String modifiers="String_Node_Str";
  int startIndex=tokens.index;
  Type type=type(context);
  Parameters params=parameters(context,0,false);
  Declarator dcl=new Declarator();
  Declaration decl=new Declaration();
  if (type.javaName.length() == 0) {
    tokens.index=backIndex;
    return false;
  }
 else   if (context.javaName == null && !type.operator && params != null) {
    if (tokens.get().match(':')) {
      for (Token token=tokens.next(); !token.match(Token.EOF); token=tokens.next()) {
        if (token.match('{',';')) {
          break;
        }
      }
    }
    if (tokens.get().match('{')) {
      body();
    }
 else {
      tokens.next();
    }
    decl.text=spacing;
    declList.add(decl);
    return true;
  }
 else   if ((type.constructor || type.destructor || type.operator) && params != null) {
    dcl.type=type;
    dcl.parameters=params;
    dcl.cppName=type.cppName;
    dcl.javaName=type.javaName.substring(type.javaName.lastIndexOf(' ') + 1);
    if (type.operator) {
      dcl.cppName="String_Node_Str" + dcl.cppName;
      dcl.javaName="String_Node_Str" + Character.toUpperCase(dcl.javaName.charAt(0)) + dcl.javaName.substring(1);
    }
    dcl.signature=dcl.javaName + params.signature;
  }
 else {
    tokens.index=startIndex;
    dcl=declarator(context,null,0,false,0,false,false);
    type=dcl.type;
  }
  if (dcl.cppName == null || type.javaName.length() == 0 || dcl.parameters == null) {
    tokens.index=backIndex;
    return false;
  }
  int namespace=dcl.cppName.lastIndexOf("String_Node_Str");
  if (context.namespace != null && namespace < 0) {
    dcl.cppName=context.namespace + "String_Node_Str" + dcl.cppName;
  }
  Info info=null;
  if (dcl.parameters != null) {
    String name=dcl.cppName + "String_Node_Str", separator="String_Node_Str";
    for (    Declarator d : dcl.parameters.declarators) {
      if (d != null) {
        name+=separator + d.type.cppName;
        for (int i=0; i < d.indirections; i++) {
          name+="String_Node_Str";
        }
        if (d.reference) {
          name+="String_Node_Str";
        }
        separator="String_Node_Str";
      }
    }
    info=infoMap.getFirst(name+="String_Node_Str");
    if (info == null && !type.constructor && !type.destructor && !type.operator) {
      infoMap.put(new Info(name));
    }
  }
  if (info == null) {
    info=infoMap.getFirst(dcl.cppName);
  }
  String localName=dcl.cppName;
  if (localName.startsWith(context.namespace + "String_Node_Str")) {
    localName=dcl.cppName.substring(context.namespace.length() + 2);
  }
  if (type.friend || (context.javaName == null && localName.contains("String_Node_Str")) || (info != null && info.skip)) {
    for (Token token=tokens.get(); !token.match(Token.EOF); token=tokens.get()) {
      if (attribute() == null) {
        break;
      }
    }
    if (tokens.get().match(':')) {
      for (Token token=tokens.next(); !token.match(Token.EOF); token=tokens.next()) {
        if (token.match('{',';')) {
          break;
        }
      }
    }
    if (tokens.get().match('{')) {
      body();
    }
 else {
      tokens.next();
    }
    decl.text=spacing;
    declList.add(decl);
    return true;
  }
 else   if (type.staticMember || context.javaName == null) {
    modifiers="String_Node_Str";
  }
  LinkedList<Declarator> prevDcl=new LinkedList<Declarator>();
  boolean first=true;
  for (int n=-2; n < Integer.MAX_VALUE; n++) {
    decl=new Declaration();
    tokens.index=startIndex;
    if ((type.constructor || type.destructor || type.operator) && params != null) {
      type=type(context);
      params=parameters(context,n / 2,n % 2 != 0);
      dcl=new Declarator();
      dcl.type=type;
      dcl.parameters=params;
      dcl.cppName=type.cppName;
      dcl.javaName=type.javaName.substring(type.javaName.lastIndexOf(' ') + 1);
      if (type.operator) {
        dcl.cppName="String_Node_Str" + dcl.cppName;
        dcl.javaName="String_Node_Str" + Character.toUpperCase(dcl.javaName.charAt(0)) + dcl.javaName.substring(1);
      }
      dcl.signature=dcl.javaName + params.signature;
      if (tokens.get().match(':')) {
        for (Token token=tokens.next(); !token.match(Token.EOF); token=tokens.next()) {
          if (token.match('{',';')) {
            break;
          }
        }
      }
    }
 else {
      dcl=declarator(context,null,n / 2,n % 2 != 0,0,false,false);
      type=dcl.type;
      namespace=dcl.cppName.lastIndexOf("String_Node_Str");
      if (context.namespace != null && namespace < 0) {
        dcl.cppName=context.namespace + "String_Node_Str" + dcl.cppName;
      }
    }
    for (Token token=tokens.get(); !token.match(Token.EOF); token=tokens.get()) {
      decl.constMember|=token.match(Token.CONST);
      if (attribute() == null) {
        break;
      }
    }
    if (tokens.get().match('{')) {
      body();
    }
 else {
      if (tokens.get().match('=')) {
        tokens.next().expect("String_Node_Str");
        tokens.next().expect(';');
        decl.abstractMember=true;
      }
      tokens.next();
    }
    if (type.virtual && context.virtualize) {
      modifiers=context.inaccessible ? "String_Node_Str" : "String_Node_Str";
    }
    decl.declarator=dcl;
    if (context.namespace != null && context.javaName == null) {
      decl.text+="String_Node_Str" + context.namespace + "String_Node_Str";
    }
    if (type.constructor && params != null) {
      decl.text+="String_Node_Str" + context.shorten(context.javaName) + dcl.parameters.list+ "String_Node_Str"+ params.names+ "String_Node_Str"+ "String_Node_Str"+ dcl.parameters.list+ "String_Node_Str";
    }
 else {
      decl.text+=modifiers + type.annotations + type.javaName+ "String_Node_Str"+ dcl.javaName+ dcl.parameters.list+ "String_Node_Str";
    }
    decl.signature=dcl.signature;
    if (info != null && info.javaText != null) {
      if (first) {
        decl.text=info.javaText;
      }
 else {
        break;
      }
    }
    String comment=commentAfter();
    if (first) {
      first=false;
      declList.spacing=spacing;
      decl.text=comment + decl.text;
    }
    boolean found=false;
    for (    Declarator d : prevDcl) {
      found|=dcl.signature.equals(d.signature);
    }
    if (dcl.javaName.length() > 0 && !found && !type.destructor) {
      declList.add(decl);
      if (type.virtual && context.virtualize) {
        break;
      }
    }
 else     if (found && n / 2 > 0 && n % 2 == 0) {
      break;
    }
    prevDcl.add(dcl);
  }
  declList.spacing=null;
  return true;
}