Program: 25539
Project: 25539
Buggy source:
private void processType(TypeElement type){
  AutoValue autoValue=type.getAnnotation(AutoValue.class);
  if (autoValue == null) {
    errorReporter.abortWithError("String_Node_Str" + "String_Node_Str",type);
  }
  if (type.getKind() != ElementKind.CLASS) {
    errorReporter.abortWithError("String_Node_Str" + AutoValue.class.getName() + "String_Node_Str",type);
  }
  if (ancestorIsAutoValue(type)) {
    errorReporter.abortWithError("String_Node_Str",type);
  }
  if (implementsAnnotation(type)) {
    errorReporter.abortWithError("String_Node_Str" + "String_Node_Str",type);
  }
  checkModifiersIfNested(type);
  ImmutableSet<ExecutableElement> methods=getLocalAndInheritedMethods(type,processingEnv.getTypeUtils(),processingEnv.getElementUtils());
  ImmutableSet<ExecutableElement> abstractMethods=abstractMethodsIn(methods);
  BuilderSpec builderSpec=new BuilderSpec(type,processingEnv,errorReporter);
  Optional<BuilderSpec.Builder> builder=builderSpec.getBuilder();
  ImmutableSet<ExecutableElement> toBuilderMethods;
  if (builder.isPresent()) {
    toBuilderMethods=builder.get().toBuilderMethods(typeUtils,abstractMethods);
  }
 else {
    toBuilderMethods=ImmutableSet.of();
  }
  ImmutableSet<ExecutableElement> propertyMethods=propertyMethodsIn(immutableSetDifference(abstractMethods,toBuilderMethods));
  ImmutableBiMap<String,ExecutableElement> properties=propertyNameToMethodMap(propertyMethods);
  ExtensionContext context=new ExtensionContext(processingEnv,type,properties,abstractMethods);
  ImmutableList<AutoValueExtension> applicableExtensions=applicableExtensions(type,context);
  ImmutableSet<ExecutableElement> consumedMethods=methodsConsumedByExtensions(type,applicableExtensions,context,abstractMethods,properties);
  if (!consumedMethods.isEmpty()) {
    ImmutableSet<ExecutableElement> allAbstractMethods=abstractMethods;
    abstractMethods=immutableSetDifference(abstractMethods,consumedMethods);
    toBuilderMethods=immutableSetDifference(toBuilderMethods,consumedMethods);
    propertyMethods=propertyMethodsIn(immutableSetDifference(abstractMethods,toBuilderMethods));
    properties=propertyNameToMethodMap(propertyMethods);
    context=new ExtensionContext(processingEnv,type,properties,allAbstractMethods);
  }
  boolean extensionsPresent=!applicableExtensions.isEmpty();
  validateMethods(type,abstractMethods,toBuilderMethods,propertyMethods,extensionsPresent);
  String finalSubclass=generatedSubclassName(type,0);
  AutoValueTemplateVars vars=new AutoValueTemplateVars();
  vars.pkg=TypeSimplifier.packageNameOf(type);
  vars.origClass=TypeSimplifier.classNameOf(type);
  vars.simpleClassName=TypeSimplifier.simpleNameOf(vars.origClass);
  vars.finalSubclass=TypeSimplifier.simpleNameOf(finalSubclass);
  vars.isFinal=applicableExtensions.isEmpty();
  vars.types=processingEnv.getTypeUtils();
  determineObjectMethodsToGenerate(methods,vars);
  TypeSimplifier typeSimplifier=defineVarsForType(type,vars,toBuilderMethods,propertyMethods,builder);
  if (isAnnotationPresent(type,AutoValue.CopyAnnotations.class)) {
    Set<String> excludedAnnotations=union(getFieldOfClasses(type,AutoValue.CopyAnnotations.class,"String_Node_Str",processingEnv.getElementUtils()),getAnnotationsMarkedWithInherited(type));
    vars.annotations=copyAnnotations(type,typeSimplifier,excludedAnnotations);
  }
 else {
    vars.annotations=ImmutableList.of();
  }
  GwtCompatibility gwtCompatibility=new GwtCompatibility(type);
  vars.gwtCompatibleAnnotation=gwtCompatibility.gwtCompatibleAnnotationString();
  String subclass=writeExtensions(type,context,applicableExtensions);
  vars.subclass=TypeSimplifier.simpleNameOf(subclass);
  String text=vars.toText();
  text=Reformatter.fixup(text);
  writeSourceFile(subclass,text,type);
  GwtSerialization gwtSerialization=new GwtSerialization(gwtCompatibility,processingEnv,type);
  gwtSerialization.maybeWriteGwtSerializer(vars);
}

Fixed version (ground truth):
private void processType(TypeElement type){
  AutoValue autoValue=type.getAnnotation(AutoValue.class);
  if (autoValue == null) {
    errorReporter.abortWithError("String_Node_Str" + "String_Node_Str",type);
  }
  if (type.getKind() != ElementKind.CLASS) {
    errorReporter.abortWithError("String_Node_Str" + AutoValue.class.getName() + "String_Node_Str",type);
  }
  if (ancestorIsAutoValue(type)) {
    errorReporter.abortWithError("String_Node_Str",type);
  }
  if (implementsAnnotation(type)) {
    errorReporter.abortWithError("String_Node_Str" + "String_Node_Str",type);
  }
  checkModifiersIfNested(type);
  ImmutableSet<ExecutableElement> methods=getLocalAndInheritedMethods(type,processingEnv.getTypeUtils(),processingEnv.getElementUtils());
  ImmutableSet<ExecutableElement> abstractMethods=abstractMethodsIn(methods);
  BuilderSpec builderSpec=new BuilderSpec(type,processingEnv,errorReporter);
  Optional<BuilderSpec.Builder> builder=builderSpec.getBuilder();
  ImmutableSet<ExecutableElement> toBuilderMethods;
  if (builder.isPresent()) {
    toBuilderMethods=builder.get().toBuilderMethods(typeUtils,abstractMethods);
  }
 else {
    toBuilderMethods=ImmutableSet.of();
  }
  ImmutableSet<ExecutableElement> propertyMethods=propertyMethodsIn(immutableSetDifference(abstractMethods,toBuilderMethods));
  ImmutableBiMap<String,ExecutableElement> properties=propertyNameToMethodMap(propertyMethods);
  ExtensionContext context=new ExtensionContext(processingEnv,type,properties,abstractMethods);
  ImmutableList<AutoValueExtension> applicableExtensions=applicableExtensions(type,context);
  ImmutableSet<ExecutableElement> consumedMethods=methodsConsumedByExtensions(type,applicableExtensions,context,abstractMethods,properties);
  if (!consumedMethods.isEmpty()) {
    ImmutableSet<ExecutableElement> allAbstractMethods=abstractMethods;
    abstractMethods=immutableSetDifference(abstractMethods,consumedMethods);
    toBuilderMethods=immutableSetDifference(toBuilderMethods,consumedMethods);
    propertyMethods=propertyMethodsIn(immutableSetDifference(abstractMethods,toBuilderMethods));
    properties=propertyNameToMethodMap(propertyMethods);
    context=new ExtensionContext(processingEnv,type,properties,allAbstractMethods);
  }
  boolean extensionsPresent=!applicableExtensions.isEmpty();
  validateMethods(type,abstractMethods,toBuilderMethods,propertyMethods,extensionsPresent);
  String finalSubclass=generatedSubclassName(type,0);
  AutoValueTemplateVars vars=new AutoValueTemplateVars();
  vars.pkg=TypeSimplifier.packageNameOf(type);
  vars.origClass=TypeSimplifier.classNameOf(type);
  vars.simpleClassName=TypeSimplifier.simpleNameOf(vars.origClass);
  vars.finalSubclass=TypeSimplifier.simpleNameOf(finalSubclass);
  vars.types=processingEnv.getTypeUtils();
  determineObjectMethodsToGenerate(methods,vars);
  TypeSimplifier typeSimplifier=defineVarsForType(type,vars,toBuilderMethods,propertyMethods,builder);
  if (isAnnotationPresent(type,AutoValue.CopyAnnotations.class)) {
    Set<String> excludedAnnotations=union(getFieldOfClasses(type,AutoValue.CopyAnnotations.class,"String_Node_Str",processingEnv.getElementUtils()),getAnnotationsMarkedWithInherited(type));
    vars.annotations=copyAnnotations(type,typeSimplifier,excludedAnnotations);
  }
 else {
    vars.annotations=ImmutableList.of();
  }
  GwtCompatibility gwtCompatibility=new GwtCompatibility(type);
  vars.gwtCompatibleAnnotation=gwtCompatibility.gwtCompatibleAnnotationString();
  int subclassDepth=writeExtensions(type,context,applicableExtensions);
  String subclass=generatedSubclassName(type,subclassDepth);
  vars.subclass=TypeSimplifier.simpleNameOf(subclass);
  vars.isFinal=(subclassDepth == 0);
  String text=vars.toText();
  text=Reformatter.fixup(text);
  writeSourceFile(subclass,text,type);
  GwtSerialization gwtSerialization=new GwtSerialization(gwtCompatibility,processingEnv,type);
  gwtSerialization.maybeWriteGwtSerializer(vars);
}