[BUG] Java 15: DecimalFormatSymbols overrides equals but not hashCode

Rob Spoor openjdk at icemanx.nl
Tue Sep 15 19:43:30 UTC 2020


Hmm, I could have sworn I checked 
https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/text/DecimalFormatSymbols.java 
and didn't find it...

I guess it's a false positive then.


On 15/09/2020 21:36, Brian Burkhalter wrote:
> Hello,
> 
> The override of hashCode() looks like it is still there in JDK 15 [1]. I don’t know however why it does not appear as such in the javadoc [2].
> 
> Brian
> 
> [1] http://hg.openjdk.java.net/jdk/jdk15/file/fb7064dc63f9/src/java.base/share/classes/java/text/DecimalFormatSymbols.java#l760
> [2] https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/text/DecimalFormatSymbols.html
> 
>> On Sep 15, 2020, at 12:14 PM, Rob Spoor <openjdk at icemanx.nl> wrote:
>>
>> In Java 14 and before, DecimalFormatSymbols had overrides for both equals and hashCode. In Java 15, the override for hashCode has disappeared, and it now inherits hashCode from java.lang.Object. That means it now violates the contract for equals + hashCode: two equal DecimalFormatSymbols instances can have different hash codes.


More information about the core-libs-dev mailing list