Skip to content

Remove sun.misc.Unsafe memory access API usage #8259

@mbien

Description

@mbien
  • JDK 24 logs warnings to console on misc.Unsafe mem access API use,
  • "JDK 26 or later" will set --sun-misc-unsafe-memory-access to deny
  • last phase removes the methods

see JEP 498.

nb 25 started on JDK 24 in terminal will print the following to console:

WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::objectFieldOffset has been called by com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper (jar:file:/home/mbien/dev/nb/java/maven/lib/guava-33.2.1-jre.jar!/)
WARNING: Please consider reporting this to the maintainers of class com.google.common.util.concurrent.AbstractFuture$UnsafeAtomicHelper
WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release

to get the full stack trace, set --sun-misc-unsafe-memory-access=debug

(but there might be more usages, guava might have it fixed in the next release google/guava#6806 (comment)) edit: guava and guice is resolved

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Code cleanupJava[ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form)Upgrade JDKUpgrade to the JDK requirements of a module.priority:highHigh priority issue that should, if possible, be fixed in next release

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions