8076031: javac should use deterministic data structures for managing free type listeners
Reviewed-by: mcimadamore, jjg
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java Fri Dec 18 09:56:17 2015 -0800
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java Fri Dec 18 14:51:50 2015 -0800
@@ -29,6 +29,7 @@
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
@@ -78,7 +79,7 @@
/** list of inference vars in this context */
List<Type> inferencevars;
- Map<FreeTypeListener, List<Type>> freeTypeListeners = new HashMap<>();
+ Map<FreeTypeListener, List<Type>> freeTypeListeners = new LinkedHashMap<>();
Types types;
Infer infer;
@@ -263,7 +264,7 @@
void notifyChange(List<Type> inferredVars) {
InferenceException thrownEx = null;
for (Map.Entry<FreeTypeListener, List<Type>> entry :
- new HashMap<>(freeTypeListeners).entrySet()) {
+ new LinkedHashMap<>(freeTypeListeners).entrySet()) {
if (!Type.containsAny(entry.getValue(), inferencevars.diff(inferredVars))) {
try {
entry.getKey().typesInferred(this);