diff --git a/gson/src/main/java/com/google/gson/JsonPrimitive.java b/gson/src/main/java/com/google/gson/JsonPrimitive.java index bae2fc48..b053c66d 100644 --- a/gson/src/main/java/com/google/gson/JsonPrimitive.java +++ b/gson/src/main/java/com/google/gson/JsonPrimitive.java @@ -351,13 +351,16 @@ public final class JsonPrimitive extends JsonElement { @Override public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } JsonPrimitive other = (JsonPrimitive)obj; if (value == null) { - if (other.value != null) return false; - } else if (!value.equals(other.value)) return false; - return true; + return other.value == null; + } + return value.equals(other.value); } }