8076031: javac should use deterministic data structures for managing free type listeners
authorvromero
Fri, 18 Dec 2015 14:51:50 -0800
changeset 34761 6400aa5e70e6
parent 34760 a0135741d02f
child 34762 d68b7daca533
8076031: javac should use deterministic data structures for managing free type listeners Reviewed-by: mcimadamore, jjg
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java
--- 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);