Reputation: 39
I update jdk 8 to jdk 11 , how to replace Unsafe.objectFieldOffset
Math.max(size, unsafe.objectFieldOffset(f) + sizeOf(f));
Upvotes: 4
Views: 981
Reputation: 39604
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.unsupported
module.
So, you can just continue using it.
Upvotes: 5