JDK 9 RFR of JDK-8067289 (XS): Fix deprecation warnings in java.base module - CRC32C
joe darcy
joe.darcy at oracle.com
Thu Dec 11 19:23:35 UTC 2014
Hi Staffan,
I haven't examined the code for possible integer overflow cases, but it
would be fundamentally safer if the values were promoted to long
*before* the arithmetic rather than after. In other words, instead of
(long)(Unsafe.ARRAY_BYTE_BASE_OFFSET + off) // Overflow
theoretically possible
use
(long)Unsafe.ARRAY_BYTE_BASE_OFFSET + off // No overflow worries
with int inputs
-Joe
On 12/11/2014 11:19 AM, Staffan Friberg wrote:
> Hi,
>
> Here is a small fix that avoids calling deprecated sun.misc.Unsafe
> methods, which allows the @SuppressWarnings to be removed.
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8067289
> Webrev: http://cr.openjdk.java.net/~sfriberg/JDK-8067289/webrev.00
>
> Regards,
> Staffan
More information about the core-libs-dev
mailing list