You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JsonPrimitive with LazilyParsedNumber integers breaks contract for hashCode() #992
While most types maintain consistency between equals() and hashCode() after string serialization and parsing (JsonElement#toString() + JsonParser#parse(String), integers do not. equals() returns true, but the hash codes are different.
public void testEqualsIntegerAndLazilyParsedInteger() {
MoreAsserts.assertEqualsAndHashCode(new JsonPrimitive(42), new JsonPrimitive(new LazilyParsedNumber("42")));
}
Reacted by Daniel Wilches, Jordan Blacker, Bertrand Vidal and Devesh Parekh
Activity
JsonPrimitive: considers integral LazilyParsedNumber as integral when…
JsonPrimitive: considers integral LazilyParsedNumber as integral when…
dwilches commentedon Apr 10, 2020
Just got hit by this 3-year old bug.
jblacker commentedon May 14, 2020
Just got hit with this bug as well. Any chance this issue will get picked up?
Add regression test for JsonPrimitive equals/hashCode contract (googl…
Fix JsonPrimitive.hashCode to honor the equals/hashCode contract (#992)…