Program: 26911
Project: 26911
Buggy source:
private void writeConstructor(TypeSpec.Builder builder){
  MethodSpec.Builder constructor=MethodSpec.constructorBuilder().addModifiers(Modifier.PUBLIC).addParameter(ClassNames.DATABASE_HOLDER,"String_Node_Str");
  for (  TableDefinition tableDefinition : manager.getTableDefinitions(databaseName)) {
    constructor.addStatement("String_Node_Str",tableDefinition.elementClassName);
  }
  for (  ModelViewDefinition modelViewDefinition : manager.getModelViewDefinitions(databaseName)) {
    constructor.addStatement("String_Node_Str",modelViewDefinition.elementClassName);
  }
  for (  QueryModelDefinition queryModelDefinition : manager.getQueryModelDefinitions(databaseName)) {
    constructor.addStatement("String_Node_Str",queryModelDefinition.elementClassName);
  }
  Map<Integer,List<MigrationDefinition>> migrationDefinitionMap=manager.getMigrationsForDatabase(databaseName);
  if (migrationDefinitionMap != null && !migrationDefinitionMap.isEmpty()) {
    List<Integer> versionSet=new ArrayList<>(migrationDefinitionMap.keySet());
    Collections.sort(versionSet);
    for (    Integer version : versionSet) {
      List<MigrationDefinition> migrationDefinitions=migrationDefinitionMap.get(version);
      Collections.sort(migrationDefinitions,new Comparator<MigrationDefinition>(){
        @Override public int compare(        MigrationDefinition o1,        MigrationDefinition o2){
          return Integer.valueOf(o2.priority).compareTo(o1.priority);
        }
      }
);
      constructor.addStatement("String_Node_Str",ParameterizedTypeName.get(ClassName.get(List.class),ClassNames.MIGRATION),version,ParameterizedTypeName.get(ArrayList.class));
      constructor.addStatement("String_Node_Str",DatabaseHandler.MIGRATION_FIELD_NAME,version,version);
      for (      MigrationDefinition migrationDefinition : migrationDefinitions) {
        constructor.addStatement("String_Node_Str",version,migrationDefinition.elementClassName);
      }
    }
  }
  for (  TableDefinition tableDefinition : manager.getTableDefinitions(databaseName)) {
    constructor.addStatement("String_Node_Str",DatabaseHandler.MODEL_FIELD_NAME,tableDefinition.elementClassName);
    constructor.addStatement("String_Node_Str",DatabaseHandler.MODEL_NAME_MAP,tableDefinition.tableName,tableDefinition.elementClassName);
    constructor.addStatement("String_Node_Str",DatabaseHandler.MODEL_ADAPTER_MAP_FIELD_NAME,tableDefinition.elementClassName,tableDefinition.outputClassName);
  }
  for (  ModelContainerDefinition modelContainerDefinition : manager.getModelContainers(databaseName)) {
    constructor.addStatement("String_Node_Str",DatabaseHandler.MODEL_CONTAINER_ADAPTER_MAP_FIELD_NAME,modelContainerDefinition.elementClassName,modelContainerDefinition.outputClassName);
  }
  for (  ModelViewDefinition modelViewDefinition : manager.getModelViewDefinitions(databaseName)) {
    constructor.addStatement("String_Node_Str",DatabaseHandler.MODEL_VIEW_FIELD_NAME,modelViewDefinition.elementClassName);
    constructor.addStatement("String_Node_Str",DatabaseHandler.MODEL_VIEW_ADAPTER_MAP_FIELD_NAME,modelViewDefinition.elementClassName,modelViewDefinition.outputClassName);
  }
  for (  QueryModelDefinition queryModelDefinition : manager.getQueryModelDefinitions(databaseName)) {
    constructor.addStatement("String_Node_Str",DatabaseHandler.QUERY_MODEL_ADAPTER_MAP_FIELD_NAME,queryModelDefinition.elementClassName,queryModelDefinition.outputClassName);
  }
  builder.addMethod(constructor.build());
}

Fixed version (ground truth):
private void writeConstructor(TypeSpec.Builder builder){
  MethodSpec.Builder constructor=MethodSpec.constructorBuilder().addModifiers(Modifier.PUBLIC).addParameter(ClassNames.DATABASE_HOLDER,"String_Node_Str");
  for (  TableDefinition tableDefinition : manager.getTableDefinitions(databaseName)) {
    constructor.addStatement("String_Node_Str",tableDefinition.elementClassName);
  }
  for (  ModelViewDefinition modelViewDefinition : manager.getModelViewDefinitions(databaseName)) {
    constructor.addStatement("String_Node_Str",modelViewDefinition.elementClassName);
  }
  for (  QueryModelDefinition queryModelDefinition : manager.getQueryModelDefinitions(databaseName)) {
    constructor.addStatement("String_Node_Str",queryModelDefinition.elementClassName);
  }
  Map<Integer,List<MigrationDefinition>> migrationDefinitionMap=manager.getMigrationsForDatabase(databaseName);
  if (migrationDefinitionMap != null && !migrationDefinitionMap.isEmpty()) {
    List<Integer> versionSet=new ArrayList<>(migrationDefinitionMap.keySet());
    Collections.sort(versionSet);
    for (    Integer version : versionSet) {
      List<MigrationDefinition> migrationDefinitions=migrationDefinitionMap.get(version);
      Collections.sort(migrationDefinitions,new Comparator<MigrationDefinition>(){
        @Override public int compare(        MigrationDefinition o1,        MigrationDefinition o2){
          return Integer.valueOf(o2.priority).compareTo(o1.priority);
        }
      }
);
      constructor.addStatement("String_Node_Str",ParameterizedTypeName.get(ClassName.get(List.class),ClassNames.MIGRATION),version,ParameterizedTypeName.get(ArrayList.class));
      constructor.addStatement("String_Node_Str",DatabaseHandler.MIGRATION_FIELD_NAME,version,version);
      for (      MigrationDefinition migrationDefinition : migrationDefinitions) {
        constructor.addStatement("String_Node_Str",version,migrationDefinition.elementClassName);
      }
    }
  }
  for (  TableDefinition tableDefinition : manager.getTableDefinitions(databaseName)) {
    constructor.addStatement("String_Node_Str",DatabaseHandler.MODEL_FIELD_NAME,tableDefinition.elementClassName);
    constructor.addStatement("String_Node_Str",DatabaseHandler.MODEL_NAME_MAP,tableDefinition.tableName,tableDefinition.elementClassName);
    constructor.addStatement("String_Node_Str",DatabaseHandler.MODEL_ADAPTER_MAP_FIELD_NAME,tableDefinition.elementClassName,tableDefinition.getAdapterClassName());
  }
  for (  ModelContainerDefinition modelContainerDefinition : manager.getModelContainers(databaseName)) {
    constructor.addStatement("String_Node_Str",DatabaseHandler.MODEL_CONTAINER_ADAPTER_MAP_FIELD_NAME,modelContainerDefinition.elementClassName,modelContainerDefinition.outputClassName);
  }
  for (  ModelViewDefinition modelViewDefinition : manager.getModelViewDefinitions(databaseName)) {
    constructor.addStatement("String_Node_Str",DatabaseHandler.MODEL_VIEW_FIELD_NAME,modelViewDefinition.elementClassName);
    constructor.addStatement("String_Node_Str",DatabaseHandler.MODEL_VIEW_ADAPTER_MAP_FIELD_NAME,modelViewDefinition.elementClassName,modelViewDefinition.outputClassName);
  }
  for (  QueryModelDefinition queryModelDefinition : manager.getQueryModelDefinitions(databaseName)) {
    constructor.addStatement("String_Node_Str",DatabaseHandler.QUERY_MODEL_ADAPTER_MAP_FIELD_NAME,queryModelDefinition.elementClassName,queryModelDefinition.outputClassName);
  }
  builder.addMethod(constructor.build());
}