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

Kevin Rushforth kevin.rushforth at oracle.com
Tue Sep 15 19:38:51 UTC 2020


I see this in DecimalFormatSymbols:


      /**
       * Override hashCode.
       */
 >>>    private volatile int hashCode;
      @Override
      public int hashCode() {

Although, I'm not sure why the intervening private field would prevent 
javadoc from generating at least a method with an empty doc.

-- Kevin

On 9/15/2020 12:36 PM, 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