JDK-8349944 : [JMH] sun.misc.UnsafeOps cannot access class jdk.internal.misc.Unsafe
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 24
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2025-02-13
  • Updated: 2025-06-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 26
26Unresolved
Related Reports
Causes :  
Relates :  
Description
* reproduce

make test TEST="micro:UnsafeOps"

* the snippet of error log

java.lang.IllegalAccessError: class org.openjdk.bench.sun.misc.UnsafeOps (in unnamed module @0x5a2e4553) cannot access class jdk.internal.misc.Unsafe (in module java.base) becau
se module java.base does not export jdk.internal.misc to unnamed module @0x5a2e4553                                                                                              
        at org.openjdk.bench.sun.misc.UnsafeOps.<clinit>(UnsafeOps.java:40)
        at org.openjdk.bench.sun.misc.jmh_generated.UnsafeOps_putLongOnHeap_jmhTest._jmh_tryInit_f_unsafeops0_0(UnsafeOps_putLongOnHeap_jmhTest.java:343)
        at org.openjdk.bench.sun.misc.jmh_generated.UnsafeOps_putLongOnHeap_jmhTest.putLongOnHeap_AverageTime(UnsafeOps_putLongOnHeap_jmhTest.java:141)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
        at java.base/java.lang.reflect.Method.invoke(Method.java:565)
        at org.openjdk.jmh.runner.BenchmarkHandler$BenchmarkTask.call(BenchmarkHandler.java:527)
        at org.openjdk.jmh.runner.BenchmarkHandler$BenchmarkTask.call(BenchmarkHandler.java:504)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:328)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:545)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:328)  
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1095)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:619)
        at java.base/java.lang.Thread.run(Thread.java:1447)
Comments
Added link to JDK-8332744, which should not have modified this file.
20-02-2025

This test should be changed back to use sun.misc.Unsafe, it should not be using jdk.internal.misc.Unsafe.
19-02-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/23686 Date: 2025-02-19 07:53:15 +0000
19-02-2025