Skip to content

Commit

Permalink
Change data structures to keep order to create reproducible jars (#4879)
Browse files Browse the repository at this point in the history
* Change data structures to keep order to create reproducible jars. Fixes #4870

* Remove unused imports
  • Loading branch information
jameskleeh committed Feb 1, 2021
1 parent ad1eda2 commit 02520ef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
public class AnnotationProcessingOutputVisitor extends AbstractClassWriterOutputVisitor {

private final Filer filer;
private final Map<String, Optional<GeneratedFile>> metaInfFiles = new HashMap<>();
private final Map<String, FileObject> openedFiles = new HashMap<>();
private final Map<String, Optional<GeneratedFile>> generatedFiles = new HashMap<>();
private final Map<String, Optional<GeneratedFile>> metaInfFiles = new LinkedHashMap<>();
private final Map<String, FileObject> openedFiles = new LinkedHashMap<>();
private final Map<String, Optional<GeneratedFile>> generatedFiles = new LinkedHashMap<>();

/**
* @param filer The {@link Filer} for creating new files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
Expand All @@ -38,7 +38,7 @@
*/
@Internal
public abstract class AbstractClassWriterOutputVisitor implements ClassWriterOutputVisitor {
private final Map<String, Set<String>> serviceDescriptors = new HashMap<>();
private final Map<String, Set<String>> serviceDescriptors = new LinkedHashMap<>();
private final boolean isWriteOnFinish;

/**
Expand All @@ -64,7 +64,7 @@ public final Map<String, Set<String>> getServiceEntries() {
@Override
public final void visitServiceDescriptor(String type, String classname) {
if (StringUtils.isNotEmpty(type) && StringUtils.isNotEmpty(classname)) {
serviceDescriptors.computeIfAbsent(type, s -> new HashSet<>()).add(classname);
serviceDescriptors.computeIfAbsent(type, s -> new LinkedHashSet<>()).add(classname);
}
}

Expand Down

0 comments on commit 02520ef

Please sign in to comment.