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

Alan Bateman alanb at openjdk.org
Thu Sep 14 10:24:05 UTC 2023


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.

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

Commit messages:
 - Initial commit

Changes: https://git.openjdk.org/jdk/pull/15707/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15707&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8316160
  Stats: 36 lines in 1 file changed: 0 ins; 36 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/15707.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15707/head:pull/15707

PR: https://git.openjdk.org/jdk/pull/15707


More information about the core-libs-dev mailing list