RFR: 8344560: Add system property for patched runtime
Alan Bateman
alanb at openjdk.org
Wed Nov 20 17:48:14 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?
I had hoped you would get more feedback on the proposal. If we do expose the property then I'm wondering about the JDK-specific properties documented in System.getProperties, and also thinking about java -XshowSettings output.
test/jdk/java/lang/System/patchedModule/ModulePatcherTest.java line 39:
> 37: * @run main/othervm --patch-module=java.base=${test.classes} ModulePatcherTest true
> 38: */
> 39: public class ModulePatcherTest {
The existing tests for --patch-module are in test/jdk/tools/launcher/modules/patch, we might want to see if we should just update one of the existing tests or move the new test with a name that makes it clear it's testing the property.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/22277#issuecomment-2489206819
PR Review Comment: https://git.openjdk.org/jdk/pull/22277#discussion_r1850743894
More information about the core-libs-dev
mailing list