RFC: Introduce JDK property jdk.patched for indicating --patch-module at runtime

David Holmes david.holmes at oracle.com
Wed Nov 13 03:44:34 UTC 2024


Hi Severin,

On 13/11/2024 1:33 am, Severin Gehwolf wrote:
> Hi,
> 
> For JDK-8343839 it would be useful to have some form of API in order to
> be able to detect that a currently running Java process has been
> launched with '--patch-module'.
> 
> Alan Bateman suggested to expose a boolean JDK property to indicate a
> runtime that has been launched with --patch-module. In particular, the
> suggestion was to use 'jdk.patched' which would be set to true iff
> --patch-module is present when the java process launched.

The VM already sets properties like

  jdk.module.patch.N=<...>

when processing --patch-mods. Doesn't that suffice if all you need is a 
boolean flag to indicate any patching has occurred?

I would have thought you'd like to know which module has been patched, 
or to be able to ask if a given module has been patch - in which case an 
actual API method on java.lang.Module would seem reasonable. Or is this 
an area where module patching is only part of the implementation of 
Modules in the JDK, not part of the actual Java SE Module specification?

Cheers,
David
-----

> The added benefit would be to have this information available via
> serviceability tools as well. For example, -XshowSettings:properties
> would be able to show this new property.
> 
> Thoughts? Concerns?
> 
> Thanks,
> Severin
> 
> 



More information about the core-libs-dev mailing list