Program: 26939
Project: 26939
Buggy source:
@Override public CodeBlock getLoadFromCursorMethod(){
  CodeBlock.Builder builder=CodeBlock.builder().add("String_Node_Str");
  CodeBlock.Builder ifNullBuilder=CodeBlock.builder().add("String_Node_Str");
  CodeBlock.Builder selectBuilder=CodeBlock.builder();
  for (int i=0; i < foreignKeyReferenceDefinitionList.size(); i++) {
    ForeignKeyReferenceDefinition referenceDefinition=foreignKeyReferenceDefinitionList.get(i);
    String indexName="String_Node_Str" + referenceDefinition.columnName;
    builder.addStatement("String_Node_Str",indexName,LoadFromCursorMethod.PARAM_CURSOR,referenceDefinition.columnName);
    if (i > 0) {
      ifNullBuilder.add("String_Node_Str");
    }
    ifNullBuilder.add("String_Node_Str",indexName,LoadFromCursorMethod.PARAM_CURSOR,indexName);
    selectBuilder.add("String_Node_Str",TableDefinition.getPropertyClassName(referencedTableClassName),referenceDefinition.foreignColumnName,LoadFromCursorMethod.PARAM_MODEL,columnAccess.getShortAccessString(elementName) + "String_Node_Str" + referenceDefinition.columnAccess.getShortAccessString(referenceDefinition.foreignColumnName));
  }
  ifNullBuilder.add("String_Node_Str");
  builder.beginControlFlow(ifNullBuilder.build().toString());
  builder.addStatement(columnAccess.setColumnAccessString(LoadFromCursorMethod.PARAM_MODEL,elementName,CodeBlock.builder().add("String_Node_Str",ClassNames.SELECT,referencedTableClassName).add(selectBuilder.build()).add("String_Node_Str").build().toString()));
  builder.endControlFlow();
  return builder.build();
}

Fixed version (ground truth):
@Override public CodeBlock getLoadFromCursorMethod(){
  CodeBlock.Builder builder=CodeBlock.builder().add("String_Node_Str");
  CodeBlock.Builder ifNullBuilder=CodeBlock.builder().add("String_Node_Str");
  CodeBlock.Builder selectBuilder=CodeBlock.builder();
  for (int i=0; i < foreignKeyReferenceDefinitionList.size(); i++) {
    ForeignKeyReferenceDefinition referenceDefinition=foreignKeyReferenceDefinitionList.get(i);
    String indexName="String_Node_Str" + referenceDefinition.columnName;
    builder.addStatement("String_Node_Str",indexName,LoadFromCursorMethod.PARAM_CURSOR,referenceDefinition.columnName);
    if (i > 0) {
      ifNullBuilder.add("String_Node_Str");
    }
    ifNullBuilder.add("String_Node_Str",indexName,LoadFromCursorMethod.PARAM_CURSOR,indexName);
    selectBuilder.add("String_Node_Str",ClassName.get(referencedTableClassName.packageName(),referencedTableClassName.simpleName() + "String_Node_Str" + TableDefinition.DBFLOW_TABLE_ADAPTER),referenceDefinition.foreignColumnName,LoadFromCursorMethod.PARAM_MODEL,columnAccess.getShortAccessString(elementName) + "String_Node_Str" + referenceDefinition.columnAccess.getShortAccessString(referenceDefinition.foreignColumnName));
  }
  ifNullBuilder.add("String_Node_Str");
  builder.beginControlFlow(ifNullBuilder.build().toString());
  builder.addStatement(columnAccess.setColumnAccessString(LoadFromCursorMethod.PARAM_MODEL,elementName,CodeBlock.builder().add("String_Node_Str",ClassNames.SELECT,referencedTableClassName).add(selectBuilder.build()).add("String_Node_Str").build().toString()));
  builder.endControlFlow();
  return builder.build();
}