@AutoCodec some expressions that show up in Java configured targets.

PiperOrigin-RevId: 189419493
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/Environment.java b/src/main/java/com/google/devtools/build/lib/syntax/Environment.java
index 86d9c36..c882743 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/Environment.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/Environment.java
@@ -557,15 +557,24 @@
       for (String name : names) {
         Object value = bindings.get(name);
         Object otherValue = otherBindings.get(name);
-        if (!value.equals(otherValue)) {
-          badEntries.add(String.format(
-              "%s: this one has %s (class %s), but given one has %s (class %s)",
-              name,
-              Printer.repr(value),
-              value.getClass().getName(),
-              Printer.repr(otherValue),
-              otherValue.getClass().getName()));
+        if (value.equals(otherValue)) {
+          continue;
         }
+        if (value instanceof SkylarkNestedSet
+            && otherValue instanceof SkylarkNestedSet
+            && (((SkylarkNestedSet) value)
+                .toCollection()
+                .equals(((SkylarkNestedSet) otherValue).toCollection()))) {
+          continue;
+        }
+        badEntries.add(
+            String.format(
+                "%s: this one has %s (class %s), but given one has %s (class %s)",
+                name,
+                Printer.repr(value),
+                value.getClass().getName(),
+                Printer.repr(otherValue),
+                otherValue.getClass().getName()));
       }
       if (!badEntries.isEmpty()) {
         throw new IllegalStateException(