dain / snappy

Port of Snappy to Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OpenJDK compatablity

kornstar11 opened this issue · comments

commented

Hello, running the following JVM:
java version "1.6.0_27"
OpenJDK Runtime Environment (IcedTea6 1.12.6) (6b27-1.12.6-1ubuntu0.12.04.2)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

I get the following compiler warnings:

src/main/java/org/iq80/snappy/UnsafeMemory.java:26: warning: sun.misc.Unsafe is internal proprietary API and may be removed in a future release
private static final Unsafe unsafe;

src/main/java/org/iq80/snappy/UnsafeMemory.java:30: warning: sun.misc.Unsafe is internal proprietary API and may be removed in a future release
Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");

src/main/java/org/iq80/snappy/UnsafeMemory.java:32: warning: sun.misc.Unsafe is internal proprietary API and may be removed in a future release
unsafe = (Unsafe) theUnsafe.get(null);

src/main/java/org/iq80/snappy/UnsafeMemory.java:101: copyMemory(long,long,long) in sun.misc.Unsafe cannot be applied to (byte[],long,byte[],long,int)
unsafe.copyMemory(input, UnsafeMemory.BYTE_ARRAY_OFFSET + inputIndex, output, UnsafeMemory.BYTE_ARRAY_OFFSET + outputIndex, length);
commented

This issue also exists on the following VM:
java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)

Snappy uses Unsafe for performance reasons and therefore has to compile agains the Unsafe classes. The implementation supports running on a VM that does not have Unsafe present (although all JVMs I know of have Unsafe).

The warnings are innocuous and unfortunately there is no way to disable the warnings.