Program: 26833
Project: 26833
Buggy source:
@Override public CodeBlock getLoadFromCursorMethod(boolean isModelContainerAdapter,boolean putNullForContainerAdapter,boolean endNonPrimitiveIf){
  if (nonModelColumn) {
    return super.getLoadFromCursorMethod(isModelContainerAdapter,putNullForContainerAdapter,endNonPrimitiveIf);
  }
 else {
    checkNeedsReferences();
    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_TAG),referenceDefinition.foreignColumnName,CodeBlock.builder().add("String_Node_Str",LoadFromCursorMethod.PARAM_CURSOR,DefinitionUtils.getLoadFromCursorMethodString(referenceDefinition.columnClassName,referenceDefinition.columnAccess),indexName).build());
    }
    ifNullBuilder.add("String_Node_Str");
    builder.beginControlFlow(ifNullBuilder.build().toString());
    CodeBlock.Builder initializer=CodeBlock.builder();
    initializer.add("String_Node_Str",ClassNames.SELECT,referencedTableClassName).add(selectBuilder.build());
    if (!isModelContainerAdapter && !isModelContainer) {
      initializer.add("String_Node_Str");
    }
 else {
      if (isModelContainerAdapter) {
        initializer.add("String_Node_Str",ModelUtils.getVariable(true),ModelUtils.getVariable(true),referencedTableClassName);
      }
 else {
        initializer.add("String_Node_Str",elementTypeName,referencedTableClassName);
      }
    }
    builder.addStatement(columnAccess.setColumnAccessString(elementTypeName,elementName,elementName,isModelContainerAdapter,ModelUtils.getVariable(isModelContainerAdapter),initializer.build(),false));
    boolean putDefaultValue=putNullForContainerAdapter;
    if (putContainerDefaultValue != putDefaultValue && isModelContainerAdapter) {
      putDefaultValue=putContainerDefaultValue;
    }
    if (putDefaultValue) {
      builder.nextControlFlow("String_Node_Str");
      builder.addStatement("String_Node_Str",ModelUtils.getVariable(true),columnName);
    }
    if (endNonPrimitiveIf) {
      builder.endControlFlow();
    }
    return builder.build();
  }
}

Fixed version (ground truth):
@Override public CodeBlock getLoadFromCursorMethod(boolean isModelContainerAdapter,boolean putNullForContainerAdapter,boolean endNonPrimitiveIf){
  if (nonModelColumn) {
    return super.getLoadFromCursorMethod(isModelContainerAdapter,putNullForContainerAdapter,endNonPrimitiveIf);
  }
 else {
    checkNeedsReferences();
    CodeBlock.Builder builder=CodeBlock.builder().add("String_Node_Str");
    CodeBlock.Builder ifNullBuilder=CodeBlock.builder().add("String_Node_Str");
    CodeBlock.Builder selectBuilder=CodeBlock.builder();
    String foreignKeyContainerRefName="String_Node_Str" + columnName;
    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);
      CodeBlock loadFromCursorBlock=CodeBlock.builder().add("String_Node_Str",LoadFromCursorMethod.PARAM_CURSOR,DefinitionUtils.getLoadFromCursorMethodString(referenceDefinition.columnClassName,referenceDefinition.columnAccess),indexName).build();
      ClassName generatedTableRef=ClassName.get(referencedTableClassName.packageName(),referencedTableClassName.simpleName() + tableDefinition.databaseDefinition.classSeparator + TableDefinition.DBFLOW_TABLE_TAG);
      if (!isForeignKeyContainer) {
        selectBuilder.add("String_Node_Str",generatedTableRef,referenceDefinition.foreignColumnName,loadFromCursorBlock);
      }
 else {
        selectBuilder.add("String_Node_Str",foreignKeyContainerRefName,referenceDefinition.foreignColumnName,loadFromCursorBlock);
      }
    }
    ifNullBuilder.add("String_Node_Str");
    builder.beginControlFlow(ifNullBuilder.build().toString());
    CodeBlock.Builder initializer=CodeBlock.builder();
    if (isForeignKeyContainer) {
      builder.addStatement("String_Node_Str",ParameterizedTypeName.get(ClassNames.FOREIGN_KEY_CONTAINER,referencedTableClassName),foreignKeyContainerRefName,ClassNames.FOREIGN_KEY_CONTAINER,referencedTableClassName);
      builder.add(selectBuilder.build()).add("String_Node_Str");
      initializer.add(foreignKeyContainerRefName);
    }
 else {
      initializer.add("String_Node_Str",ClassNames.SELECT,referencedTableClassName).add(selectBuilder.build());
      if (!isModelContainerAdapter && !isModelContainer) {
        initializer.add("String_Node_Str");
      }
 else {
        if (isModelContainerAdapter) {
          initializer.add("String_Node_Str",ModelUtils.getVariable(true),ModelUtils.getVariable(true),referencedTableClassName);
        }
 else {
          initializer.add("String_Node_Str",elementTypeName,referencedTableClassName);
        }
      }
    }
    builder.addStatement(columnAccess.setColumnAccessString(elementTypeName,elementName,elementName,isModelContainerAdapter,ModelUtils.getVariable(isModelContainerAdapter),initializer.build(),false));
    boolean putDefaultValue=putNullForContainerAdapter;
    if (putContainerDefaultValue != putDefaultValue && isModelContainerAdapter) {
      putDefaultValue=putContainerDefaultValue;
    }
    if (putDefaultValue) {
      builder.nextControlFlow("String_Node_Str");
      builder.addStatement("String_Node_Str",ModelUtils.getVariable(true),columnName);
    }
    if (endNonPrimitiveIf) {
      builder.endControlFlow();
    }
    return builder.build();
  }
}