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

Brian Burkhalter brian.burkhalter at oracle.com
Tue Sep 15 19:50:41 UTC 2020


> On Sep 15, 2020, at 12:38 PM, Kevin Rushforth <kevin.rushforth at oracle.com> wrote:
> 
> 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.

Moving the hashCode private field before the comment block causes the javadoc to be generated as expected.

--- a/src/java.base/share/classes/java/text/DecimalFormatSymbols.java
+++ b/src/java.base/share/classes/java/text/DecimalFormatSymbols.java
@@ -757,10 +757,11 @@
             locale.equals(other.locale));
     }
 
+    private volatile int hashCode;
+
     /**
      * Override hashCode.
      */
-    private volatile int hashCode;
     @Override
     public int hashCode() {
         if (hashCode == 0) {


> On Sep 15, 2020, at 12:43 PM, Rob Spoor <openjdk at icemanx.nl> wrote:
> 
> Hmm, I could have sworn I checked https://urldefense.com/v3/__https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/text/DecimalFormatSymbols.java__;!!GqivPVa7Brio!JJ8ymM95_Eg-fb-IIWGHHAvXTmKEX7h9-vSxyH73DxsjaS_0-bNOJ96Ud_1LMFCR1G0m$ <https://urldefense.com/v3/__https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/text/DecimalFormatSymbols.java__;!!GqivPVa7Brio!JJ8ymM95_Eg-fb-IIWGHHAvXTmKEX7h9-vSxyH73DxsjaS_0-bNOJ96Ud_1LMFCR1G0m$> and didn't find it...
> 
> I guess it's a false positive then.

In the sense that the hsdhCode() method is not in fact removed, but it is a bug that the javadoc is not generated as one would expect.

Thanks,

Brian


More information about the core-libs-dev mailing list