Program: 25593
Project: 25593
Buggy source:
@Override public boolean process(Set<? extends TypeElement> annotations,RoundEnvironment roundEnv){
  Messager messager=processingEnv.getMessager();
  Elements elements=processingEnv.getElementUtils();
  ProvidedChecker providedChecker=new ProvidedChecker(messager);
  for (  Element element : roundEnv.getElementsAnnotatedWith(Provided.class)) {
    providedChecker.checkProvidedParameter(element);
  }
  FactoryDescriptorGenerator factoryDescriptorGenerator=new FactoryDescriptorGenerator(messager,elements);
  FactoryWriter factoryWriter=new FactoryWriter(processingEnv.getFiler());
  for (  Element element : roundEnv.getElementsAnnotatedWith(AutoFactory.class)) {
    ImmutableSet<FactoryMethodDescriptor> descriptors=factoryDescriptorGenerator.generateDescriptor(element);
    ImmutableListMultimap<String,FactoryMethodDescriptor> indexedMethods=Multimaps.index(descriptors,new Function<FactoryMethodDescriptor,String>(){
      @Override public String apply(      FactoryMethodDescriptor descriptor){
        return descriptor.factoryName();
      }
    }
);
    for (    Entry<String,Collection<FactoryMethodDescriptor>> entry : indexedMethods.asMap().entrySet()) {
      ImmutableSet.Builder<String> extending=ImmutableSet.builder();
      ImmutableSet.Builder<String> implementing=ImmutableSet.builder();
      for (      FactoryMethodDescriptor methodDescriptor : entry.getValue()) {
        extending.add(methodDescriptor.declaration().extendingQualifiedName());
        implementing.addAll(methodDescriptor.declaration().implementingQualifiedNames());
      }
      try {
        factoryWriter.writeFactory(new FactoryDescriptor(entry.getKey(),Iterables.getOnlyElement(extending.build()),implementing.build(),ImmutableSet.copyOf(entry.getValue())),element);
      }
 catch (      IOException e) {
        messager.printMessage(Kind.ERROR,"String_Node_Str",element);
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean process(Set<? extends TypeElement> annotations,RoundEnvironment roundEnv){
  Messager messager=processingEnv.getMessager();
  Elements elements=processingEnv.getElementUtils();
  ProvidedChecker providedChecker=new ProvidedChecker(messager);
  for (  Element element : roundEnv.getElementsAnnotatedWith(Provided.class)) {
    providedChecker.checkProvidedParameter(element);
  }
  FactoryDescriptorGenerator factoryDescriptorGenerator=new FactoryDescriptorGenerator(messager,elements);
  FactoryWriter factoryWriter=new FactoryWriter(processingEnv.getFiler());
  ImmutableListMultimap.Builder<String,FactoryMethodDescriptor> indexedMethods=ImmutableListMultimap.builder();
  for (  Element element : roundEnv.getElementsAnnotatedWith(AutoFactory.class)) {
    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();
    ImmutableSet.Builder<String> implementing=ImmutableSet.builder();
    for (    FactoryMethodDescriptor methodDescriptor : entry.getValue()) {
      extending.add(methodDescriptor.declaration().extendingQualifiedName());
      implementing.addAll(methodDescriptor.declaration().implementingQualifiedNames());
    }
    try {
      factoryWriter.writeFactory(new FactoryDescriptor(entry.getKey(),Iterables.getOnlyElement(extending.build()),implementing.build(),ImmutableSet.copyOf(entry.getValue())));
    }
 catch (    IOException e) {
      messager.printMessage(Kind.ERROR,"String_Node_Str");
    }
  }
  return false;
}