changeset 28064:cd22a60e9459

8067289: Fix deprecation warnings in java.base module - CRC32C Summary: to remove the deprecation warning in CRC32C class Reviewed-by: darcy Contributed-by: staffan.friberg@oracle.com
author sherman
date Tue, 16 Dec 2014 04:58:34 +0000
parents 997c263dff16
children b35a5a7f6dcc
files jdk/src/java.base/share/classes/java/util/zip/CRC32C.java
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java	Mon Dec 15 17:36:20 2014 -0500
+++ b/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java	Tue Dec 16 04:58:34 2014 +0000
@@ -204,7 +204,6 @@
     /**
      * Updates the CRC-32C checksum with the specified array of bytes.
      */
-    @SuppressWarnings("deprecation") // Unsafe.{getInt, getLong}
     private static int updateBytes(int crc, byte[] b, int off, int end) {
 
         // Do only byte reads for arrays so short they can't be aligned
@@ -228,11 +227,11 @@
                 int secondHalf;
                 if (Unsafe.ADDRESS_SIZE == 4) {
                     // On 32 bit platforms read two ints instead of a single 64bit long
-                    firstHalf = UNSAFE.getInt(b, Unsafe.ARRAY_BYTE_BASE_OFFSET + off);
-                    secondHalf = UNSAFE.getInt(b, Unsafe.ARRAY_BYTE_BASE_OFFSET + off
+                    firstHalf = UNSAFE.getInt(b, (long)Unsafe.ARRAY_BYTE_BASE_OFFSET + off);
+                    secondHalf = UNSAFE.getInt(b, (long)Unsafe.ARRAY_BYTE_BASE_OFFSET + off
                                                + Integer.BYTES);
                 } else {
-                    long value = UNSAFE.getLong(b, Unsafe.ARRAY_BYTE_BASE_OFFSET + off);
+                    long value = UNSAFE.getLong(b, (long)Unsafe.ARRAY_BYTE_BASE_OFFSET + off);
                     if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) {
                         firstHalf = (int) value;
                         secondHalf = (int) (value >>> 32);