From 0d379b5ce89d01cf74044eb057d8c822e6cfb811 Mon Sep 17 00:00:00 2001 From: dprokurat Date: Mon, 3 Feb 2020 16:09:12 -0800 Subject: [PATCH] No need to compare arrays item-by-item if they are the same object. RELNOTES=none ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=293028181 --- core/src/main/java/com/google/common/truth/Subject.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/src/main/java/com/google/common/truth/Subject.java b/core/src/main/java/com/google/common/truth/Subject.java index a38f1ca2c..ff4a91654 100644 --- a/core/src/main/java/com/google/common/truth/Subject.java +++ b/core/src/main/java/com/google/common/truth/Subject.java @@ -536,6 +536,9 @@ private static ComparisonResult checkByteArrayEquals(byte[] expected, byte[] act */ private static ComparisonResult checkArrayEqualsRecursive( Object expectedArray, Object actualArray, String lastIndex) { + if (expectedArray == actualArray) { + return ComparisonResult.equal(); + } String expectedType = arrayType(expectedArray); String actualType = arrayType(actualArray); if (!expectedType.equals(actualType)) {