RFR: 8344560: Add system property for patched runtime [v3]

Roger Riggs rriggs at openjdk.org
Fri Nov 22 17:34:17 UTC 2024


On Fri, 22 Nov 2024 17:04:38 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?
>
> Severin Gehwolf has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Mention jdk.patched in System class

I could use some background, the property itself seems like a hack, and those tend to live too long.
What state that might be patched is used to create the new image? How does jlink know that a configuration has been modified and refuse to make a new image.
What part of the new image does not come from the jrt: file system?  It seems like it should be possible to check the codesource of all classes to see if they are the originals.

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

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


More information about the core-libs-dev mailing list