RFR: 8344560: Add system property for patched runtime

Jaikiran Pai jpai at openjdk.org
Thu Nov 21 05:52:24 UTC 2024


On Wed, 20 Nov 2024 14:26:27 GMT, Severin Gehwolf <sgehwolf at 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?

Having now looked at https://github.com/openjdk/jdk/pull/22037/ which is what motivated this change, I now have a more basic question.

The `--patch-module` option is an option for the `java` command. The code changes in this current PR is proposing to set a system property if `java` was launched with `--patch-module=...`. The other PR is about image creation using `jlink` command. Looking at the other PR, it proposes to look for the presence of this system property to do some decisions during image creation. However, when that `jlink` command is invoked, it's a completely different process/runtime, so how would `--patch-module` for `java` setting a system property propagate to that image creation `jlink` process?

I am feeling that I have misunderstood what's being proposed here.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/22277#issuecomment-2490133685


More information about the core-libs-dev mailing list