JDK-8310661 : JFR: Replace JVM.getJVM() with JVM
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: jfr
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-06-22
  • Updated: 2023-07-12
  • Resolved: 2023-07-03
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 22
22 b05Fixed
Description
Some of the methods in the jdk.jfr.internal.JVM class are static while others are instance methods. I believe all could be static. Benefits are:

- Consistency
- No need to cache the JVM object in various places

I think JVM.getJVM() was copied from Unsafe.getUnsafe(), but there is no reflection check in getJVM(), so the methods might as well be static.
Comments
Changeset: ba974d5c Author: Erik Gahlin <egahlin@openjdk.org> Date: 2023-07-03 12:19:57 +0000 URL: https://git.openjdk.org/jdk/commit/ba974d5c62c332905b0466b704411a829d6c9ee3
03-07-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/14713 Date: 2023-06-29 14:57:15 +0000
30-06-2023