Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change data structures to keep order to create reproducible jars #4879

Merged
merged 2 commits into from
Feb 1, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -25,6 +25,8 @@
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 +40,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 +66,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