Program: 155628
Project: 155628
Buggy source:
private void emitToStringMethod(JavaWriter writer) throws IOException {
  if (metadata.containsToString()) {
    return;
  }
  writer.emitAnnotation("String_Node_Str");
  writer.beginMethod("String_Node_Str","String_Node_Str",EnumSet.of(Modifier.PUBLIC));
  writer.beginControlFlow("String_Node_Str");
  writer.emitStatement("String_Node_Str");
  writer.endControlFlow();
  writer.emitStatement("String_Node_Str",simpleClassName);
  List<VariableElement> fields=metadata.getFields();
  for (int i=0; i < fields.size(); i++) {
    VariableElement field=fields.get(i);
    String fieldName=field.getSimpleName().toString();
    writer.emitStatement("String_Node_Str",fieldName);
    if (Utils.isRealmModel(field)) {
      String fieldTypeSimpleName=Utils.getFieldTypeSimpleName(field);
      writer.emitStatement("String_Node_Str",metadata.getGetter(fieldName),fieldTypeSimpleName);
    }
 else     if (Utils.isRealmList(field)) {
      String genericTypeSimpleName=Utils.getGenericTypeSimpleName(field);
      writer.emitStatement("String_Node_Str",genericTypeSimpleName,metadata.getGetter(fieldName));
    }
 else {
      if (metadata.isNullable(field)) {
        writer.emitStatement("String_Node_Str",metadata.getGetter(fieldName),metadata.getGetter(fieldName));
      }
 else {
        writer.emitStatement("String_Node_Str",metadata.getGetter(fieldName));
      }
    }
    writer.emitStatement("String_Node_Str");
    if (i < fields.size() - 1) {
      writer.emitStatement("String_Node_Str");
    }
  }
  writer.emitStatement("String_Node_Str");
  writer.emitStatement("String_Node_Str");
  writer.endMethod();
  writer.emitEmptyLine();
}

Fixed version (ground truth):
private void emitToStringMethod(JavaWriter writer) throws IOException {
  if (metadata.containsToString()) {
    return;
  }
  writer.emitAnnotation("String_Node_Str");
  writer.emitAnnotation("String_Node_Str","String_Node_Str");
  writer.beginMethod("String_Node_Str","String_Node_Str",EnumSet.of(Modifier.PUBLIC));
  writer.beginControlFlow("String_Node_Str");
  writer.emitStatement("String_Node_Str");
  writer.endControlFlow();
  writer.emitStatement("String_Node_Str",simpleClassName);
  List<VariableElement> fields=metadata.getFields();
  for (int i=0; i < fields.size(); i++) {
    VariableElement field=fields.get(i);
    String fieldName=field.getSimpleName().toString();
    writer.emitStatement("String_Node_Str",fieldName);
    if (Utils.isRealmModel(field)) {
      String fieldTypeSimpleName=Utils.getFieldTypeSimpleName(field);
      writer.emitStatement("String_Node_Str",metadata.getGetter(fieldName),fieldTypeSimpleName);
    }
 else     if (Utils.isRealmList(field)) {
      String genericTypeSimpleName=Utils.getGenericTypeSimpleName(field);
      writer.emitStatement("String_Node_Str",genericTypeSimpleName,metadata.getGetter(fieldName));
    }
 else {
      if (metadata.isNullable(field)) {
        writer.emitStatement("String_Node_Str",metadata.getGetter(fieldName),metadata.getGetter(fieldName));
      }
 else {
        writer.emitStatement("String_Node_Str",metadata.getGetter(fieldName));
      }
    }
    writer.emitStatement("String_Node_Str");
    if (i < fields.size() - 1) {
      writer.emitStatement("String_Node_Str");
    }
  }
  writer.emitStatement("String_Node_Str");
  writer.emitStatement("String_Node_Str");
  writer.endMethod();
  writer.emitEmptyLine();
}