I update jdk 8 to jdk 11 , how to replace Unsafe.objectFieldOffset
Math.max(size, unsafe.objectFieldOffset(f) + sizeOf(f));
I update jdk 8 to jdk 11 , how to replace Unsafe.objectFieldOffset
Math.max(size, unsafe.objectFieldOffset(f) + sizeOf(f));
sun.misc.Unsafe is a Critical Internal API which was not encapsulated in JDK 9:
These APIs are thus accessible by default to code on the class path, and accessible to code in modules if those modules declare dependences upon the
jdk.unsupportedmodule.
So, you can just continue using it.