On Tue, 12 Nov 2024 11:00:36 GMT, Severin Gehwolf <sgehw...@openjdk.org> wrote:
> Please review this fix to how patched modules are being handled when linking > from the run-time image. During review of > [JDK-8311302](https://bugs.openjdk.org/browse/JDK-8311302) it was pointed out > that module patching should be detected earlier and the link should get > aborted in that case. > > This patch implements it, by looking at the `jdk.module.patch.0` property > like [other code in the > JDK](https://github.com/openjdk/jdk/blob/2c1e4c381615ce52276f4bf331a1e7a845af4b6e/src/hotspot/share/cds/cdsConfig.cpp#L282) > does. After this patch module patching is being detected before any archives > are being read or the actual linking process starts (contrary to the previous > solution). > > Testing: > - [x] GHA testing (mac aarch64 test failures are infra related) > - [x] Local testing of existing test, which covers it > > Thoughts? src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java line 625: > 623: // Do not permit linking from run-time image when the > current image > 624: // is being patched > 625: if > (jdk.internal.misc.VM.getSavedProperties().get("jdk.module.patch.0") != null) > { I don't think we should introduce this dependency. Instead, I think we should look at adding a property such as jdk.patched, with a boolean value, to indicate if the current runtime is patched or not. This could be useful for java -XshowSettings output too. src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink.properties line 128: > 126: \ --keep-packaged-modules is not supported > 127: err.runtime.link.modified.file={0} has been modified > 128: err.runtime.link.patched.module=The current runtime includes module > patches.\ Not sure about "module patches", its more that the current runtime has been patched with --patch-module. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/22037#discussion_r1837935419 PR Review Comment: https://git.openjdk.org/jdk/pull/22037#discussion_r1837936172