How many methods have been deprecated in sun.misc.Unsafe? (JEP 471)

Alan Bateman alan.bateman at oracle.com
Fri Sep 13 14:43:42 UTC 2024


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20240913/0c2f0549/attachment.htm>


More information about the core-libs-dev mailing list