changeset 3179:1cdf5548051d

8076031: javac should use deterministic data structures for managing free type listeners Reviewed-by: mcimadamore, jjg
author vromero
date Fri, 18 Dec 2015 14:51:50 -0800
parents 9d7f9a016783
children cb73b474703e
files src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java	Fri Dec 18 09:56:17 2015 -0800
+++ b/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);