Program: 106658
Project: 106658
Buggy source:
private static ArrayList<Argument> setResponseFields(Field[] responseFields){
  ArrayList<Argument> arguments=new ArrayList<Argument>();
  ArrayList<Argument> sortedChildlessArguments=new ArrayList<Argument>();
  ArrayList<Argument> sortedArguments=new ArrayList<Argument>();
  Argument id=null;
  for (  Field responseField : responseFields) {
    SerializedName nameAnnotation=responseField.getAnnotation(SerializedName.class);
    Param paramAnnotation=responseField.getAnnotation(Param.class);
    Argument respArg=new Argument(nameAnnotation.value());
    boolean hasChildren=false;
    if (paramAnnotation != null && paramAnnotation.includeInApiDoc()) {
      String description=paramAnnotation.description();
      Class fieldClass=paramAnnotation.responseObject();
      if (description != null && !description.isEmpty()) {
        respArg.setDescription(description);
      }
      if (fieldClass != null) {
        Class<?> superClass=fieldClass.getSuperclass();
        if (superClass != null) {
          String superName=superClass.getName();
          if (superName.equals(BaseResponse.class.getName())) {
            ArrayList<Argument> fieldArguments=new ArrayList<Argument>();
            Field[] fields=fieldClass.getDeclaredFields();
            fieldArguments=setResponseFields(fields);
            respArg.setArguments(fieldArguments);
            hasChildren=true;
          }
        }
      }
    }
    if (paramAnnotation != null && paramAnnotation.includeInApiDoc()) {
      if (nameAnnotation.value().equals("String_Node_Str")) {
        id=respArg;
      }
 else {
        if (hasChildren) {
          respArg.setName(nameAnnotation.value() + "String_Node_Str");
          sortedArguments.add(respArg);
        }
 else {
          sortedChildlessArguments.add(respArg);
        }
      }
    }
  }
  Collections.sort(sortedArguments);
  Collections.sort(sortedChildlessArguments);
  if (id != null) {
    arguments.add(id);
  }
  arguments.addAll(sortedChildlessArguments);
  arguments.addAll(sortedArguments);
  return arguments;
}

Fixed version (ground truth):
private static ArrayList<Argument> setResponseFields(Field[] responseFields){
  ArrayList<Argument> arguments=new ArrayList<Argument>();
  ArrayList<Argument> sortedChildlessArguments=new ArrayList<Argument>();
  ArrayList<Argument> sortedArguments=new ArrayList<Argument>();
  Argument id=null;
  for (  Field responseField : responseFields) {
    SerializedName nameAnnotation=responseField.getAnnotation(SerializedName.class);
    if (nameAnnotation != null) {
      Param paramAnnotation=responseField.getAnnotation(Param.class);
      Argument respArg=new Argument(nameAnnotation.value());
      boolean hasChildren=false;
      if (paramAnnotation != null && paramAnnotation.includeInApiDoc()) {
        String description=paramAnnotation.description();
        Class fieldClass=paramAnnotation.responseObject();
        if (description != null && !description.isEmpty()) {
          respArg.setDescription(description);
        }
        if (fieldClass != null) {
          Class<?> superClass=fieldClass.getSuperclass();
          if (superClass != null) {
            String superName=superClass.getName();
            if (superName.equals(BaseResponse.class.getName())) {
              ArrayList<Argument> fieldArguments=new ArrayList<Argument>();
              Field[] fields=fieldClass.getDeclaredFields();
              fieldArguments=setResponseFields(fields);
              respArg.setArguments(fieldArguments);
              hasChildren=true;
            }
          }
        }
      }
      if (paramAnnotation != null && paramAnnotation.includeInApiDoc()) {
        if (nameAnnotation.value().equals("String_Node_Str")) {
          id=respArg;
        }
 else {
          if (hasChildren) {
            respArg.setName(nameAnnotation.value() + "String_Node_Str");
            sortedArguments.add(respArg);
          }
 else {
            sortedChildlessArguments.add(respArg);
          }
        }
      }
    }
  }
  Collections.sort(sortedArguments);
  Collections.sort(sortedChildlessArguments);
  if (id != null) {
    arguments.add(id);
  }
  arguments.addAll(sortedChildlessArguments);
  arguments.addAll(sortedArguments);
  return arguments;
}