Program: 26841
Project: 26841
Buggy source:
public void writeAdapter(ProcessingEnvironment processingEnvironment) throws IOException {
  TypeSpec.Builder typeBuilder=TypeSpec.classBuilder(adapterName).addModifiers(Modifier.PUBLIC,Modifier.FINAL).superclass(ParameterizedTypeName.get(ClassNames.MODEL_ADAPTER,elementClassName));
  InternalAdapterHelper.writeGetModelClass(typeBuilder,elementClassName);
  InternalAdapterHelper.writeGetTableName(typeBuilder,tableName);
  if (hasAutoIncrement) {
    InternalAdapterHelper.writeUpdateAutoIncrement(typeBuilder,elementClassName,autoIncrementDefinition,false);
    typeBuilder.addMethod(MethodSpec.methodBuilder("String_Node_Str").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC,Modifier.FINAL).addParameter(elementClassName,ModelUtils.getVariable(false)).addStatement("String_Node_Str",autoIncrementDefinition.getColumnAccessString(false,false)).returns(ClassName.get(Number.class)).build());
    typeBuilder.addMethod(MethodSpec.methodBuilder("String_Node_Str").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC,Modifier.FINAL).addStatement("String_Node_Str",QueryBuilder.stripQuotes(autoIncrementDefinition.columnName)).returns(ClassName.get(String.class)).build());
  }
  if (cachingEnabled) {
    typeBuilder.addMethod(MethodSpec.methodBuilder("String_Node_Str").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC,Modifier.FINAL).addStatement("String_Node_Str",true).returns(TypeName.BOOLEAN).build());
    List<ColumnDefinition> primaries=primaryColumnDefinitions;
    if (primaries == null || primaries.isEmpty()) {
      primaries=Lists.newArrayList(autoIncrementDefinition);
    }
    InternalAdapterHelper.writeGetCachingId(typeBuilder,elementClassName,primaries,false);
    MethodSpec.Builder cachingbuilder=MethodSpec.methodBuilder("String_Node_Str").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC,Modifier.FINAL);
    String columns="String_Node_Str";
    for (int i=0; i < primaries.size(); i++) {
      ColumnDefinition column=primaries.get(i);
      if (i > 0) {
        columns+="String_Node_Str";
      }
      columns+="String_Node_Str" + QueryBuilder.quoteIfNeeded(column.columnName) + "String_Node_Str";
    }
    columns+="String_Node_Str";
    cachingbuilder.addStatement(columns).returns(ArrayTypeName.of(ClassName.get(String.class)));
    typeBuilder.addMethod(cachingbuilder.build());
    if (cacheSize != Table.DEFAULT_CACHE_SIZE) {
      typeBuilder.addMethod(MethodSpec.methodBuilder("String_Node_Str").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC,Modifier.FINAL).addStatement("String_Node_Str",cacheSize).returns(TypeName.INT).build());
    }
    if (!StringUtils.isNullOrEmpty(customCacheFieldName)) {
      typeBuilder.addMethod(MethodSpec.methodBuilder("String_Node_Str").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC,Modifier.FINAL).addStatement("String_Node_Str",elementClassName,customCacheFieldName).returns(ParameterizedTypeName.get(ClassNames.MODEL_CACHE,elementClassName,WildcardTypeName.subtypeOf(Object.class))).build());
    }
    if (!StringUtils.isNullOrEmpty(customMultiCacheFieldName)) {
      typeBuilder.addMethod(MethodSpec.methodBuilder("String_Node_Str").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC,Modifier.FINAL).addStatement("String_Node_Str",elementClassName,customMultiCacheFieldName).returns(ParameterizedTypeName.get(ClassNames.MULTI_KEY_CACHE_CONVERTER,WildcardTypeName.subtypeOf(Object.class),elementClassName)).build());
    }
    if (foreignKeyDefinitions.size() > 0) {
      MethodSpec.Builder reloadMethod=MethodSpec.methodBuilder("String_Node_Str").addAnnotation(Override.class).addParameter(elementClassName,ModelUtils.getVariable(false)).addParameter(ClassNames.CURSOR,LoadFromCursorMethod.PARAM_CURSOR).addModifiers(Modifier.PUBLIC,Modifier.FINAL);
      CodeBlock.Builder loadStatements=CodeBlock.builder();
      for (      ColumnDefinition foreignColumn : foreignKeyDefinitions) {
        CodeBlock.Builder codeBuilder=foreignColumn.getLoadFromCursorMethod(false,false,false).toBuilder();
        if (!foreignColumn.elementTypeName.isPrimitive()) {
          codeBuilder.nextControlFlow("String_Node_Str");
          codeBuilder.addStatement(foreignColumn.setColumnAccessString(CodeBlock.builder().add("String_Node_Str").build(),false));
          codeBuilder.endControlFlow();
        }
        loadStatements.add(codeBuilder.build());
      }
      reloadMethod.addCode(loadStatements.build());
      typeBuilder.addMethod(reloadMethod.build());
    }
  }
  CustomTypeConverterPropertyMethod customTypeConverterPropertyMethod=new CustomTypeConverterPropertyMethod(this);
  customTypeConverterPropertyMethod.addToType(typeBuilder);
  CodeBlock.Builder constructorCode=CodeBlock.builder();
  customTypeConverterPropertyMethod.addCode(constructorCode);
  typeBuilder.addMethod(MethodSpec.constructorBuilder().addParameter(ClassNames.DATABASE_HOLDER,"String_Node_Str").addCode(constructorCode.build()).addModifiers(Modifier.PUBLIC).build());
  for (  MethodDefinition methodDefinition : methods) {
    MethodSpec spec=methodDefinition.getMethodSpec();
    if (spec != null) {
      typeBuilder.addMethod(spec);
    }
  }
  typeBuilder.addMethod(MethodSpec.methodBuilder("String_Node_Str").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC,Modifier.FINAL).addStatement("String_Node_Str",elementClassName).returns(elementClassName).build());
  typeBuilder.addMethod(MethodSpec.methodBuilder("String_Node_Str").addAnnotation(Override.class).addParameter(ClassName.get(String.class),"String_Node_Str").addModifiers(Modifier.PUBLIC,Modifier.FINAL).addStatement("String_Node_Str",outputClassName,"String_Node_Str").returns(ClassNames.BASE_PROPERTY).build());
  if (!updateConflictActionName.isEmpty()) {
    typeBuilder.addMethod(MethodSpec.methodBuilder("String_Node_Str").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC,Modifier.FINAL).addStatement("String_Node_Str",ClassNames.CONFLICT_ACTION,updateConflictActionName).returns(ClassNames.CONFLICT_ACTION).build());
  }
  if (!insertConflictActionName.isEmpty()) {
    typeBuilder.addMethod(MethodSpec.methodBuilder("String_Node_Str").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC,Modifier.FINAL).addStatement("String_Node_Str",ClassNames.CONFLICT_ACTION,insertConflictActionName).returns(ClassNames.CONFLICT_ACTION).build());
  }
  JavaFile.Builder javaFileBuilder=JavaFile.builder(packageName,typeBuilder.build());
  javaFileBuilder.build().writeTo(processingEnvironment.getFiler());
}

Fixed version (ground truth):
public void writeAdapter(ProcessingEnvironment processingEnvironment) throws IOException {
  TypeSpec.Builder typeBuilder=TypeSpec.classBuilder(adapterName).addModifiers(Modifier.PUBLIC,Modifier.FINAL).superclass(ParameterizedTypeName.get(ClassNames.MODEL_ADAPTER,elementClassName));
  InternalAdapterHelper.writeGetModelClass(typeBuilder,elementClassName);
  InternalAdapterHelper.writeGetTableName(typeBuilder,tableName);
  if (hasAutoIncrement) {
    InternalAdapterHelper.writeUpdateAutoIncrement(typeBuilder,elementClassName,autoIncrementDefinition,false);
    typeBuilder.addMethod(MethodSpec.methodBuilder("String_Node_Str").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC,Modifier.FINAL).addParameter(elementClassName,ModelUtils.getVariable(false)).addStatement("String_Node_Str",autoIncrementDefinition.getColumnAccessString(false,false)).returns(ClassName.get(Number.class)).build());
    typeBuilder.addMethod(MethodSpec.methodBuilder("String_Node_Str").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC,Modifier.FINAL).addStatement("String_Node_Str",QueryBuilder.stripQuotes(autoIncrementDefinition.columnName)).returns(ClassName.get(String.class)).build());
  }
  if (cachingEnabled) {
    typeBuilder.addMethod(MethodSpec.methodBuilder("String_Node_Str").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC,Modifier.FINAL).addStatement("String_Node_Str",true).returns(TypeName.BOOLEAN).build());
    List<ColumnDefinition> primaries=primaryColumnDefinitions;
    if (primaries == null || primaries.isEmpty()) {
      primaries=Lists.newArrayList(autoIncrementDefinition);
    }
    InternalAdapterHelper.writeGetCachingId(typeBuilder,elementClassName,primaries,false);
    MethodSpec.Builder cachingbuilder=MethodSpec.methodBuilder("String_Node_Str").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC,Modifier.FINAL);
    String columns="String_Node_Str";
    for (int i=0; i < primaries.size(); i++) {
      ColumnDefinition column=primaries.get(i);
      if (i > 0) {
        columns+="String_Node_Str";
      }
      columns+="String_Node_Str" + QueryBuilder.quoteIfNeeded(column.columnName) + "String_Node_Str";
    }
    columns+="String_Node_Str";
    cachingbuilder.addStatement(columns).returns(ArrayTypeName.of(ClassName.get(String.class)));
    typeBuilder.addMethod(cachingbuilder.build());
    if (cacheSize != Table.DEFAULT_CACHE_SIZE) {
      typeBuilder.addMethod(MethodSpec.methodBuilder("String_Node_Str").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC,Modifier.FINAL).addStatement("String_Node_Str",cacheSize).returns(TypeName.INT).build());
    }
    if (!StringUtils.isNullOrEmpty(customCacheFieldName)) {
      typeBuilder.addMethod(MethodSpec.methodBuilder("String_Node_Str").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC,Modifier.FINAL).addStatement("String_Node_Str",elementClassName,customCacheFieldName).returns(ParameterizedTypeName.get(ClassNames.MODEL_CACHE,elementClassName,WildcardTypeName.subtypeOf(Object.class))).build());
    }
    if (!StringUtils.isNullOrEmpty(customMultiCacheFieldName)) {
      typeBuilder.addMethod(MethodSpec.methodBuilder("String_Node_Str").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC,Modifier.FINAL).addStatement("String_Node_Str",elementClassName,customMultiCacheFieldName).returns(ParameterizedTypeName.get(ClassNames.MULTI_KEY_CACHE_CONVERTER,WildcardTypeName.subtypeOf(Object.class))).build());
    }
    if (foreignKeyDefinitions.size() > 0) {
      MethodSpec.Builder reloadMethod=MethodSpec.methodBuilder("String_Node_Str").addAnnotation(Override.class).addParameter(elementClassName,ModelUtils.getVariable(false)).addParameter(ClassNames.CURSOR,LoadFromCursorMethod.PARAM_CURSOR).addModifiers(Modifier.PUBLIC,Modifier.FINAL);
      CodeBlock.Builder loadStatements=CodeBlock.builder();
      for (      ColumnDefinition foreignColumn : foreignKeyDefinitions) {
        CodeBlock.Builder codeBuilder=foreignColumn.getLoadFromCursorMethod(false,false,false).toBuilder();
        if (!foreignColumn.elementTypeName.isPrimitive()) {
          codeBuilder.nextControlFlow("String_Node_Str");
          codeBuilder.addStatement(foreignColumn.setColumnAccessString(CodeBlock.builder().add("String_Node_Str").build(),false));
          codeBuilder.endControlFlow();
        }
        loadStatements.add(codeBuilder.build());
      }
      reloadMethod.addCode(loadStatements.build());
      typeBuilder.addMethod(reloadMethod.build());
    }
  }
  CustomTypeConverterPropertyMethod customTypeConverterPropertyMethod=new CustomTypeConverterPropertyMethod(this);
  customTypeConverterPropertyMethod.addToType(typeBuilder);
  CodeBlock.Builder constructorCode=CodeBlock.builder();
  customTypeConverterPropertyMethod.addCode(constructorCode);
  typeBuilder.addMethod(MethodSpec.constructorBuilder().addParameter(ClassNames.DATABASE_HOLDER,"String_Node_Str").addCode(constructorCode.build()).addModifiers(Modifier.PUBLIC).build());
  for (  MethodDefinition methodDefinition : methods) {
    MethodSpec spec=methodDefinition.getMethodSpec();
    if (spec != null) {
      typeBuilder.addMethod(spec);
    }
  }
  typeBuilder.addMethod(MethodSpec.methodBuilder("String_Node_Str").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC,Modifier.FINAL).addStatement("String_Node_Str",elementClassName).returns(elementClassName).build());
  typeBuilder.addMethod(MethodSpec.methodBuilder("String_Node_Str").addAnnotation(Override.class).addParameter(ClassName.get(String.class),"String_Node_Str").addModifiers(Modifier.PUBLIC,Modifier.FINAL).addStatement("String_Node_Str",outputClassName,"String_Node_Str").returns(ClassNames.BASE_PROPERTY).build());
  if (!updateConflictActionName.isEmpty()) {
    typeBuilder.addMethod(MethodSpec.methodBuilder("String_Node_Str").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC,Modifier.FINAL).addStatement("String_Node_Str",ClassNames.CONFLICT_ACTION,updateConflictActionName).returns(ClassNames.CONFLICT_ACTION).build());
  }
  if (!insertConflictActionName.isEmpty()) {
    typeBuilder.addMethod(MethodSpec.methodBuilder("String_Node_Str").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC,Modifier.FINAL).addStatement("String_Node_Str",ClassNames.CONFLICT_ACTION,insertConflictActionName).returns(ClassNames.CONFLICT_ACTION).build());
  }
  JavaFile.Builder javaFileBuilder=JavaFile.builder(packageName,typeBuilder.build());
  javaFileBuilder.build().writeTo(processingEnvironment.getFiler());
}