RFR: 6692: JMC is asking to unlock Commercial Features on JFR enabled OpenJDK8
Alex Macdonald
aptmac at openjdk.java.net
Thu Feb 13 20:07:05 UTC 2020
This pull request addresses JMC-6692 [[0]](https://bugs.openjdk.java.net/browse/JMC-6692), in which JMC will ask to unlock commercial features when trying to use Flight Recorder on a JFR-enabled OpenJDK 8.
The most important change here is the check on `java.vm.vendor` to `java.vm.name`, because the vendor string for Oracle and OpenJDK JVMs are the same. Now it's checking specifically if the name is `Java HotSpot` when determining `isOracle()`.
The patch for including JFR into OpenJDK 8 also allows for a flag to be set when configuring the build which prevents JFR from being enabled (i.e., `-XX:+FlightRecorder` will not turn it on). This causes a problem because `JVMSupportToolkit.isFlightRecorderDisabled()` will throw an exception when looking up the value of that flag on JFR-disabled OpenJDK 8, causing it to return `false`. This results in the `StartRecordingAction` opening the commercial features wizard/dialog because it thinks that JFR is available but not disabled via the VM option, but in reality its disabled from the build. I've added a function (`hasFlightRecorder()`) to the `JVMSupportToolkit` that returns true only if it's an Oracle JDK or if the VM option exists.
I've verified this with Oracle JDK (1.8.0_241), my Fedora `dnf install`-ed OpenJDK 8, OpenJDK 8u-dev builds with both `--disable-jfr` and `--enable-jfr`, and publicly downloadable (at your own risk) jfr-enabled builds from [builds.shipilev.net](https://builds.shipilev.net/ ) [1].
Additionally, does anyone know where I can find valid Japanese and Chinese translations for the updated dialog message? FWIW the Japanese one doesn't mention OpenJDK 11+, so it hasn't been updated in a while.
[0] https://bugs.openjdk.java.net/browse/JMC-6692
[1] https://builds.shipilev.net/openjdk-jdk8-jfr/
After: Oracle JDK 1.8.0_241 (pressing yes does enable JFR)

After: OpenJDK 8 with JFR disabled in the build

After: OpenJDK 8 with JFR enabled in the build

-------------
Commits:
- 662ccdfc: fixed formatting by running mvn spotless:apply
- 457cf0e2: 6692: JMC is asking to unlock Commercial Features on JFR enabled OpenJDK8
Changes: https://git.openjdk.java.net/jmc/pull/53/files
Webrev: https://webrevs.openjdk.java.net/jmc/53/webrev.00
Issue: https://bugs.openjdk.java.net/browse/JMC-6692
Stats: 74 lines in 9 files changed: 36 ins; 0 del; 38 mod
Patch: https://git.openjdk.java.net/jmc/pull/53.diff
Fetch: git fetch https://git.openjdk.java.net/jmc pull/53/head:pull/53
PR: https://git.openjdk.java.net/jmc/pull/53
More information about the jmc-dev
mailing list