Use a LinkedHashMap do the addition of dictionnaries
Previously, the resulting map was using a HashMap as an intermediate
map to construct the final map then converted to an ImmutableMap.
HashMap iteration or is non-deterministic and can even vary between
execution of the same binary.
--
MOS_MIGRATED_REVID=93512467
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/BinaryOperatorExpression.java b/src/main/java/com/google/devtools/build/lib/syntax/BinaryOperatorExpression.java
index 3d6b593a..ff7c322 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/BinaryOperatorExpression.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/BinaryOperatorExpression.java
@@ -300,7 +300,8 @@
if (lval instanceof Map<?, ?> && rval instanceof Map<?, ?>) {
Map<?, ?> ldict = (Map<?, ?>) lval;
Map<?, ?> rdict = (Map<?, ?>) rval;
- Map<Object, Object> result = Maps.newHashMapWithExpectedSize(ldict.size() + rdict.size());
+ Map<Object, Object> result =
+ Maps.newLinkedHashMapWithExpectedSize(ldict.size() + rdict.size());
result.putAll(ldict);
result.putAll(rdict);
return ImmutableMap.copyOf(result);