RFR: 8316160: Remove sun.misc.Unsafe.{shouldBeInitialized,ensureClassInitialized}

Mandy Chung mchung at openjdk.org
Thu Sep 14 18:24:38 UTC 2023


On Wed, 13 Sep 2023 09:50:35 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> Unsafe.{shouldBeInitialized,ensureClassInitialized} are deprecated for removal since JDK 15. It's time to remove them. Lookup.ensureInitialized(Class) was added in Java 15 as a standard API to ensure that an accessible class is initialized. 
> 
> A search of 175973022 classes in 484751 artifacts found:
> - 23 usages of Unsafe.shouldBeInitialized, of which 8 are unique
> - 121 usages of Unsafe.ensureClassInitialized, of which 31 are unique
> 
> Not a lot of usage, many of the usages seem to be code compiled to older releases.

Marked as reviewed by mchung (Reviewer).

-------------

PR Review: https://git.openjdk.org/jdk/pull/15707#pullrequestreview-1627514371


More information about the core-libs-dev mailing list