diff --git a/java/core/src/main/java/com/google/protobuf/ByteString.java b/java/core/src/main/java/com/google/protobuf/ByteString.java index 8d1d0c8d6ee79..4e94fda672e44 100644 --- a/java/core/src/main/java/com/google/protobuf/ByteString.java +++ b/java/core/src/main/java/com/google/protobuf/ByteString.java @@ -1555,8 +1555,7 @@ public final boolean equals( if (thisHash != 0 && thatHash != 0 && thisHash != thatHash) { return false; } - - return equalsRange((LiteralByteString) other, 0, size()); + return Arrays.equals(bytes, otherAsLiteral.bytes); } else { // RopeByteString and NioByteString. return other.equals(this);