JDK 10 RFR of JDK-8138672: Math. negativeZeroFloatBits and Math. negativeZeroDoubleBits should be final
Paul Sandoz
paul.sandoz at oracle.com
Fri May 5 00:39:40 UTC 2017
> On 4 May 2017, at 16:59, joe darcy <joe.darcy at oracle.com> wrote:
>
> Hello,
>
> Please review the patch below to address
>
> JDK-8138672: Math. negativeZeroFloatBits and Math. negativeZeroDoubleBits should be final
>
+1
Paul.
> 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