Skip to content
Permalink
Browse files
8240734: ModuleHashes attribute not reproducible between builds
Reviewed-by: alanb
  • Loading branch information
dongbohe authored and Fei Yang committed Mar 9, 2020
1 parent aac5b27 commit f4b54881811353ab61748db5af7f93b6c40efb2d
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@
import java.security.NoSuchAlgorithmException;
import java.util.Collections;
import java.util.HashMap;
import java.util.TreeMap;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
@@ -134,7 +135,7 @@ public String algorithm() {
* @return ModuleHashes that encapsulates the hashes
*/
public static ModuleHashes generate(Map<String, Path> map, String algorithm) {
Map<String, byte[]> nameToHash = new HashMap<>();
Map<String, byte[]> nameToHash = new TreeMap<>();
for (Map.Entry<String, Path> entry: map.entrySet()) {
String name = entry.getKey();
Path path = entry.getValue();
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@
import java.util.Collections;
import java.util.Deque;
import java.util.HashMap;
import java.util.TreeMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -98,7 +99,7 @@ public ModuleHashesBuilder(Configuration config, Set<String> modules) {
// the modules to record the hashes - it is the first matching
// module and has not been hashed during the traversal.
Set<String> mods = new HashSet<>();
Map<String, ModuleHashes> hashes = new HashMap<>();
Map<String, ModuleHashes> hashes = new TreeMap<>();
builder.build()
.orderedNodes()
.filter(mn -> roots.contains(mn) && !mods.contains(mn))

0 comments on commit f4b5488

Please sign in to comment.