JDK 10 RFR of JDK-8138672: Math. negativeZeroFloatBits and Math. negativeZeroDoubleBits should be final

joe darcy joe.darcy at oracle.com
Thu May 4 23:59:02 UTC 2017


Hello,

Please review the patch below to address

     JDK-8138672: Math. negativeZeroFloatBits and Math. 
negativeZeroDoubleBits should be final

The build works after the change; no other static fields in 
java.lang.Math have a missing final modifier.

Thanks,

-Joe

diff -r 32f118110e09 src/java.base/share/classes/java/lang/Math.java
--- a/src/java.base/share/classes/java/lang/Math.java    Thu May 04 
18:13:42 2017 +0100
+++ b/src/java.base/share/classes/java/lang/Math.java    Thu May 04 
16:58:10 2017 -0700
@@ -1442,8 +1442,8 @@
      }

      // Use raw bit-wise conversions on guaranteed non-NaN arguments.
-    private static long negativeZeroFloatBits  = 
Float.floatToRawIntBits(-0.0f);
-    private static long negativeZeroDoubleBits = 
Double.doubleToRawLongBits(-0.0d);
+    private static final long negativeZeroFloatBits  = 
Float.floatToRawIntBits(-0.0f);
+    private static final long negativeZeroDoubleBits = 
Double.doubleToRawLongBits(-0.0d);

      /**
       * Returns the greater of two {@code float} values.  That is,



More information about the core-libs-dev mailing list