diff --git a/EventBusAnnotationProcessor/src/org/greenrobot/eventbus/annotationprocessor/EventBusAnnotationProcessor.java b/EventBusAnnotationProcessor/src/org/greenrobot/eventbus/annotationprocessor/EventBusAnnotationProcessor.java index 058bc36e..772d617f 100644 --- a/EventBusAnnotationProcessor/src/org/greenrobot/eventbus/annotationprocessor/EventBusAnnotationProcessor.java +++ b/EventBusAnnotationProcessor/src/org/greenrobot/eventbus/annotationprocessor/EventBusAnnotationProcessor.java @@ -25,7 +25,9 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; +import java.util.TreeMap; import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.Messager; @@ -48,7 +50,6 @@ import de.greenrobot.common.ListMap; - import static net.ltgt.gradle.incap.IncrementalAnnotationProcessorType.AGGREGATING; /** @@ -369,12 +370,17 @@ private void createInfoIndexFile(String index) { } private void writeIndexLines(BufferedWriter writer, String myPackage) throws IOException { + Map classMethods = new TreeMap<>(); for (TypeElement subscriberTypeElement : methodsByClass.keySet()) { if (classesToSkip.contains(subscriberTypeElement)) { continue; } - String subscriberClass = getClassString(subscriberTypeElement, myPackage); + classMethods.put(subscriberClass, subscriberTypeElement); + } + for(Map.Entry entry: classMethods.entrySet()) { + String subscriberClass = entry.getKey(); + TypeElement subscriberTypeElement = entry.getValue(); if (isVisible(myPackage, subscriberTypeElement)) { writeLine(writer, 2, "putIndex(new SimpleSubscriberInfo(" + subscriberClass + ".class,",