Summary
Change the normal preview APIs added by JEP 425 "Virtual Threads (Preview)" to the jdk.jdi
, jdk.management
, and jdk.jfr
modules to be reflective preview APIs.
Problem
JEP 425 added debugging and tooling APIs to expose and support virtual threads. Debuggers and tools will use these APIs to monitor application code running in virtual threads. During the preview period for virtual threads, it should be possible for debuggers and tools to get a jump on supporting virtual threads by using these APIs without having to opt in to preview features. Examples:
A debugger runs in a separate VM to the application being debugged. The application (running in the "target VM") may be running with preview features enabled and making use of virtual threads. The debugger (in its own VM) may need to test if a
Thread
in the target VM is a virtual thread.A tool that consumes a recording produced by JDK Flight Recorder. The recording may have been produced on a VM that ran with preview features enabled and where the application made use of virtual threads.
Solution
JEP 425 added normal preview APIs to the jdk.jdi
, jdk.management
, and jdk.jfr
modules. These preview APIs will be flagged as reflective preview APIs instead. This will allow code using these APIs to be compiled without enabling preview features but with a warning that the APIs are a reflective preview API that may be removed or upgraded to permanent in the future (see JLS section 1.5 and JEP 12). The signatures and semantics of these preview APIs are otherwise unchanged.
Specification
Change the @PreviewFeature
annotation on the following APIs to set the reflective
element to true
.
- jdk.jdi/com.sun.jdi.ThreadReference.isVirtual
- jdk.jdi/com.sun.jdi.request.ThreadStartRequest.addPlatformThreadFilter
- jdk.jdi/com.sun.jdi.request.ThreadDeathRequest.addPlatformThreadFilter
- jdk.management/com.sun.management.HotSpotDiagnosticMXBean.dumpThreads
- jdk.management/com.sun.management.HotSpotDiagnosticMXBean.ThreadDumpFormat
- jdk.jfr/com.jfr.consumer.RecordedThread.isVirtual
- csr of
-
JDK-8288289 Preview APIs in jdk.jdi, jdk.management, and jdk.jfr should be reflective preview APIs
-
- Resolved
-