On Wed, 20 Nov 2024 14:26:27 GMT, Severin Gehwolf <sgehw...@openjdk.org> wrote:
> Please review this simple patch which adds a new external system property > `jdk.patched` when the runtime has been patched with the `--patch-module` > switch. This is useful for two reasons: 1) it allows one to determine at > run-time whether or not `--patch-module` has been used (by querying the said > property) 2) allows tools, such as `jlink` doing the same without needing to > expose internal properties the JVM sets on initialization. > > Testing: > > - [x] GHA (includes new test) > - [x] New jtreg test > > Thoughts? src/hotspot/share/runtime/arguments.cpp line 2272: > 2270: if (res == JNI_OK) { > 2271: // Add jdk.patched system property when processing of args was > OK > 2272: PropertyList_unique_add(&_system_properties, "jdk.patched", > "true", Hello Severin, in addition, should we explicitly set this system property to `false` (or remove the system property) when `--patch-module` isn't used? I think that would then prevent applications from passing `-Djdk.patched=true` when the runtime hasn't been patched. While at it, should there be additional guards to prevent applications from changing the value of this system property by doing `System.setProperty("jdk.patched")` at runtime? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/22277#discussion_r1851376171