Program: 25550
Project: 25550
Buggy source:
private void doProcess(RoundEnvironment roundEnv){
  for (  Element element : roundEnv.getElementsAnnotatedWith(Provided.class)) {
    providedChecker.checkProvidedParameter(element);
  }
  ImmutableListMultimap.Builder<String,FactoryMethodDescriptor> indexedMethods=ImmutableListMultimap.builder();
  ImmutableSet.Builder<ImplementationMethodDescriptor> implementationMethodDescriptors=ImmutableSet.builder();
  for (  Element element : roundEnv.getElementsAnnotatedWith(AutoFactory.class)) {
    Optional<AutoFactoryDeclaration> declaration=declarationFactory.createIfValid(element);
    if (declaration.isPresent()) {
      TypeElement extendingType=declaration.get().extendingType();
      List<ExecutableElement> supertypeMethods=ElementFilter.methodsIn(elements.getAllMembers(extendingType));
      for (      ExecutableElement supertypeMethod : supertypeMethods) {
        if (supertypeMethod.getModifiers().contains(Modifier.ABSTRACT)) {
          ExecutableType methodType=Elements2.getExecutableElementAsMemberOf(types,supertypeMethod,extendingType);
          implementationMethodDescriptors.add(new ImplementationMethodDescriptor.Builder().name(supertypeMethod.getSimpleName().toString()).returnType(getAnnotatedType(element).getQualifiedName().toString()).publicMethod().passedParameters(Parameter.forParameterList(supertypeMethod.getParameters(),methodType.getParameterTypes())).build());
        }
      }
      for (      TypeElement implementingType : declaration.get().implementingTypes()) {
        List<ExecutableElement> interfaceMethods=ElementFilter.methodsIn(elements.getAllMembers(implementingType));
        for (        ExecutableElement interfaceMethod : interfaceMethods) {
          if (interfaceMethod.getModifiers().contains(Modifier.ABSTRACT)) {
            ExecutableType methodType=Elements2.getExecutableElementAsMemberOf(types,interfaceMethod,implementingType);
            implementationMethodDescriptors.add(new ImplementationMethodDescriptor.Builder().name(interfaceMethod.getSimpleName().toString()).returnType(getAnnotatedType(element).getQualifiedName().toString()).publicMethod().passedParameters(Parameter.forParameterList(interfaceMethod.getParameters(),methodType.getParameterTypes())).build());
          }
        }
      }
    }
    ImmutableSet<FactoryMethodDescriptor> descriptors=factoryDescriptorGenerator.generateDescriptor(element);
    indexedMethods.putAll(Multimaps.index(descriptors,new Function<FactoryMethodDescriptor,String>(){
      @Override public String apply(      FactoryMethodDescriptor descriptor){
        return descriptor.factoryName();
      }
    }
));
  }
  for (  Entry<String,Collection<FactoryMethodDescriptor>> entry : indexedMethods.build().asMap().entrySet()) {
    ImmutableSet.Builder<String> extending=ImmutableSet.builder();
    ImmutableSortedSet.Builder<String> implementing=ImmutableSortedSet.naturalOrder();
    boolean publicType=false;
    Boolean allowSubclasses=null;
    boolean skipCreation=false;
    for (    FactoryMethodDescriptor methodDescriptor : entry.getValue()) {
      extending.add(methodDescriptor.declaration().extendingType().getQualifiedName().toString());
      for (      TypeElement implementingType : methodDescriptor.declaration().implementingTypes()) {
        implementing.add(implementingType.getQualifiedName().toString());
      }
      publicType|=methodDescriptor.publicMethod();
      if (allowSubclasses == null) {
        allowSubclasses=methodDescriptor.declaration().allowSubclasses();
      }
 else       if (!allowSubclasses.equals(methodDescriptor.declaration().allowSubclasses())) {
        skipCreation=true;
        messager.printMessage(Kind.ERROR,"String_Node_Str",methodDescriptor.declaration().target(),methodDescriptor.declaration().mirror(),methodDescriptor.declaration().valuesMap().get("String_Node_Str"));
      }
    }
    if (!skipCreation) {
      try {
        factoryWriter.writeFactory(new FactoryDescriptor(entry.getKey(),Iterables.getOnlyElement(extending.build()),implementing.build(),publicType,ImmutableSet.copyOf(entry.getValue()),implementationMethodDescriptors.build(),allowSubclasses));
      }
 catch (      IOException e) {
        messager.printMessage(Kind.ERROR,"String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
private void doProcess(RoundEnvironment roundEnv){
  for (  Element element : roundEnv.getElementsAnnotatedWith(Provided.class)) {
    providedChecker.checkProvidedParameter(element);
  }
  ImmutableListMultimap.Builder<String,FactoryMethodDescriptor> indexedMethods=ImmutableListMultimap.builder();
  ImmutableSetMultimap.Builder<String,ImplementationMethodDescriptor> implementationMethodDescriptorsBuilder=ImmutableSetMultimap.builder();
  for (  Element element : roundEnv.getElementsAnnotatedWith(AutoFactory.class)) {
    Optional<AutoFactoryDeclaration> declaration=declarationFactory.createIfValid(element);
    if (declaration.isPresent()) {
      String factoryName=declaration.get().getFactoryName(elements.getPackageOf(element).getQualifiedName(),getAnnotatedType(element).getSimpleName());
      TypeElement extendingType=declaration.get().extendingType();
      List<ExecutableElement> supertypeMethods=ElementFilter.methodsIn(elements.getAllMembers(extendingType));
      for (      ExecutableElement supertypeMethod : supertypeMethods) {
        if (supertypeMethod.getModifiers().contains(Modifier.ABSTRACT)) {
          ExecutableType methodType=Elements2.getExecutableElementAsMemberOf(types,supertypeMethod,extendingType);
          implementationMethodDescriptorsBuilder.put(factoryName,new ImplementationMethodDescriptor.Builder().name(supertypeMethod.getSimpleName().toString()).returnType(getAnnotatedType(element).getQualifiedName().toString()).publicMethod().passedParameters(Parameter.forParameterList(supertypeMethod.getParameters(),methodType.getParameterTypes())).build());
        }
      }
      for (      TypeElement implementingType : declaration.get().implementingTypes()) {
        List<ExecutableElement> interfaceMethods=ElementFilter.methodsIn(elements.getAllMembers(implementingType));
        for (        ExecutableElement interfaceMethod : interfaceMethods) {
          if (interfaceMethod.getModifiers().contains(Modifier.ABSTRACT)) {
            ExecutableType methodType=Elements2.getExecutableElementAsMemberOf(types,interfaceMethod,implementingType);
            implementationMethodDescriptorsBuilder.put(factoryName,new ImplementationMethodDescriptor.Builder().name(interfaceMethod.getSimpleName().toString()).returnType(getAnnotatedType(element).getQualifiedName().toString()).publicMethod().passedParameters(Parameter.forParameterList(interfaceMethod.getParameters(),methodType.getParameterTypes())).build());
          }
        }
      }
    }
    ImmutableSet<FactoryMethodDescriptor> descriptors=factoryDescriptorGenerator.generateDescriptor(element);
    indexedMethods.putAll(Multimaps.index(descriptors,new Function<FactoryMethodDescriptor,String>(){
      @Override public String apply(      FactoryMethodDescriptor descriptor){
        return descriptor.factoryName();
      }
    }
));
  }
  ImmutableSetMultimap<String,ImplementationMethodDescriptor> implementationMethodDescriptors=implementationMethodDescriptorsBuilder.build();
  for (  Entry<String,Collection<FactoryMethodDescriptor>> entry : indexedMethods.build().asMap().entrySet()) {
    ImmutableSet.Builder<String> extending=ImmutableSet.builder();
    ImmutableSortedSet.Builder<String> implementing=ImmutableSortedSet.naturalOrder();
    boolean publicType=false;
    Boolean allowSubclasses=null;
    boolean skipCreation=false;
    for (    FactoryMethodDescriptor methodDescriptor : entry.getValue()) {
      extending.add(methodDescriptor.declaration().extendingType().getQualifiedName().toString());
      for (      TypeElement implementingType : methodDescriptor.declaration().implementingTypes()) {
        implementing.add(implementingType.getQualifiedName().toString());
      }
      publicType|=methodDescriptor.publicMethod();
      if (allowSubclasses == null) {
        allowSubclasses=methodDescriptor.declaration().allowSubclasses();
      }
 else       if (!allowSubclasses.equals(methodDescriptor.declaration().allowSubclasses())) {
        skipCreation=true;
        messager.printMessage(Kind.ERROR,"String_Node_Str",methodDescriptor.declaration().target(),methodDescriptor.declaration().mirror(),methodDescriptor.declaration().valuesMap().get("String_Node_Str"));
      }
    }
    if (!skipCreation) {
      try {
        factoryWriter.writeFactory(new FactoryDescriptor(entry.getKey(),Iterables.getOnlyElement(extending.build()),implementing.build(),publicType,ImmutableSet.copyOf(entry.getValue()),implementationMethodDescriptors.get(entry.getKey()),allowSubclasses));
      }
 catch (      IOException e) {
        messager.printMessage(Kind.ERROR,"String_Node_Str");
      }
    }
  }
}