diff --git a/gson/src/main/java/com/google/gson/JsonPrimitive.java b/gson/src/main/java/com/google/gson/JsonPrimitive.java index 827de959b9..7095c05a35 100644 --- a/gson/src/main/java/com/google/gson/JsonPrimitive.java +++ b/gson/src/main/java/com/google/gson/JsonPrimitive.java @@ -285,7 +285,7 @@ public boolean equals(Object obj) { return other.value == null; } if (isIntegral(this) && isIntegral(other)) { - return this.value instanceof BigInteger || other.value instanceof BigInteger + return (this.value instanceof BigInteger || other.value instanceof BigInteger) ? this.getAsBigInteger().equals(other.getAsBigInteger()) : this.getAsNumber().longValue() == other.getAsNumber().longValue(); }