VarHandle does provide suitable (and better) replacements for the various
Unsafe.get/putXXX methods. But, U.objectFieldOffset() is the only (easy?)
Java way to inspect the layout of a class; e.g. say you apply a hacky
class-hierarchy based cacheline padding to a field, and then want to assert
Out of curiosity: What do you use Unsafe.objectFieldOffset for that
VarHandle is lacking functionality for?
It is useful to gather use cases not covered by VarHandle so that we can
propose additional capabilities there (preparing for a world with no Unsafe
in it). Can you share an example of
i usr Unsafe.objectFieldOffset in jdk 8 ,but when i want to update jdk to
11, the idea compile error , it cannot found the symbol Unsafe.
i have try to find VarHandle api,but it did not
support Unsafe.objectFieldOffset
--
You received this message because you are subscribed to the Google