On 13/09/2024 10:49, Zheka Kozlov wrote:
Hello!
JEP 471 says that 79 methods out of 87 have been deprecated in
sun.misc.Unsafe. However, I have a different number.
Deprecated for removal in Java 18:
1. public long objectFieldOffset(Field f)
2. public Object staticFieldBase(Field f)
3. public long staticFieldOffset(Field f)
These three were ordinarily deprecated in JDK 18, then deprecated for
removal in JDK 23.
I didn't check the numbers, the main thing with this JEP is that it
contains the roadmap for removal for everything except the 3 instance
methods that you listed at the end. It's important that developers
maintaining libraries using Unsafe are looking at VarHandle and FFM APIs.
-Alan