Program: 25546
Project: 25546
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);
  }
  ImmutableSet<ExecutableElement> methods=getLocalAndInheritedMethods(type,processingEnv.getElementUtils());
  ImmutableSet<ExecutableElement> methodsToImplement=methodsToImplement(methods);
  String fqExtClass=TypeSimplifier.classNameOf(type);
  List<AutoValueExtension> appliedExtensions=new ArrayList<AutoValueExtension>();
  AutoValueExtension.Context context=makeExtensionContext(type,methodsToImplement);
  for (  AutoValueExtension extension : extensions) {
    if (extension.applicable(context)) {
      if (extension.mustBeAtEnd(context)) {
        appliedExtensions.add(0,extension);
      }
 else {
        appliedExtensions.add(extension);
      }
    }
  }
  String finalSubclass=generatedSubclassName(type,0);
  String subclass=generatedSubclassName(type,appliedExtensions.size());
  AutoValueTemplateVars vars=new AutoValueTemplateVars();
  vars.pkg=TypeSimplifier.packageNameOf(type);
  vars.origClass=fqExtClass;
  vars.simpleClassName=TypeSimplifier.simpleNameOf(vars.origClass);
  vars.subclass=TypeSimplifier.simpleNameOf(subclass);
  vars.finalSubclass=TypeSimplifier.simpleNameOf(finalSubclass);
  vars.isFinal=appliedExtensions.isEmpty();
  vars.types=processingEnv.getTypeUtils();
  defineVarsForType(type,vars,methods);
  GwtCompatibility gwtCompatibility=new GwtCompatibility(type);
  vars.gwtCompatibleAnnotation=gwtCompatibility.gwtCompatibleAnnotationString();
  String text=vars.toText();
  text=Reformatter.fixup(text);
  writeSourceFile(subclass,text,type);
  GwtSerialization gwtSerialization=new GwtSerialization(gwtCompatibility,processingEnv,type);
  gwtSerialization.maybeWriteGwtSerializer(vars);
  String extClass=TypeSimplifier.simpleNameOf(subclass);
  for (int i=appliedExtensions.size() - 1; i >= 0; i--) {
    AutoValueExtension extension=appliedExtensions.remove(i);
    String fqClassName=generatedSubclassName(type,i);
    String className=TypeSimplifier.simpleNameOf(fqClassName);
    boolean isFinal=(i == 0);
    String source=extension.generateClass(context,className,extClass,isFinal);
    if (source == null || source.isEmpty()) {
      errorReporter.reportError("String_Node_Str",type);
      return;
    }
    source=Reformatter.fixup(source);
    writeSourceFile(fqClassName,source,type);
    extClass=className;
  }
}

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);
  }
  ImmutableSet<ExecutableElement> methods=getLocalAndInheritedMethods(type,processingEnv.getElementUtils());
  ImmutableSet<ExecutableElement> methodsToImplement=methodsToImplement(type,methods);
  String fqExtClass=TypeSimplifier.classNameOf(type);
  List<AutoValueExtension> appliedExtensions=new ArrayList<AutoValueExtension>();
  AutoValueExtension.Context context=makeExtensionContext(type,methodsToImplement);
  for (  AutoValueExtension extension : extensions) {
    if (extension.applicable(context)) {
      if (extension.mustBeAtEnd(context)) {
        appliedExtensions.add(0,extension);
      }
 else {
        appliedExtensions.add(extension);
      }
    }
  }
  String finalSubclass=generatedSubclassName(type,0);
  String subclass=generatedSubclassName(type,appliedExtensions.size());
  AutoValueTemplateVars vars=new AutoValueTemplateVars();
  vars.pkg=TypeSimplifier.packageNameOf(type);
  vars.origClass=fqExtClass;
  vars.simpleClassName=TypeSimplifier.simpleNameOf(vars.origClass);
  vars.subclass=TypeSimplifier.simpleNameOf(subclass);
  vars.finalSubclass=TypeSimplifier.simpleNameOf(finalSubclass);
  vars.isFinal=appliedExtensions.isEmpty();
  vars.types=processingEnv.getTypeUtils();
  defineVarsForType(type,vars,methods);
  GwtCompatibility gwtCompatibility=new GwtCompatibility(type);
  vars.gwtCompatibleAnnotation=gwtCompatibility.gwtCompatibleAnnotationString();
  String text=vars.toText();
  text=Reformatter.fixup(text);
  writeSourceFile(subclass,text,type);
  GwtSerialization gwtSerialization=new GwtSerialization(gwtCompatibility,processingEnv,type);
  gwtSerialization.maybeWriteGwtSerializer(vars);
  String extClass=TypeSimplifier.simpleNameOf(subclass);
  for (int i=appliedExtensions.size() - 1; i >= 0; i--) {
    AutoValueExtension extension=appliedExtensions.remove(i);
    String fqClassName=generatedSubclassName(type,i);
    String className=TypeSimplifier.simpleNameOf(fqClassName);
    boolean isFinal=(i == 0);
    String source=extension.generateClass(context,className,extClass,isFinal);
    if (source == null || source.isEmpty()) {
      errorReporter.reportError("String_Node_Str",type);
      return;
    }
    source=Reformatter.fixup(source);
    writeSourceFile(fqClassName,source,type);
    extClass=className;
  }
}