RFR: 8345573: Module dependencies not resolved from run-time image when --limit-module is being used [v2]
Severin Gehwolf
sgehwolf at openjdk.org
Mon Dec 9 18:35:12 UTC 2024
> Please review this fix for JEP 493 enabled JDKs related to the `--limit-modules` option. The existing jlink `bindservices` tests cover this issue. Previously they didn't run on a JEP 493 enabled JDK, since `jmods` folder is missing for them.
>
> The gist of the issue is that multiple `ModuleFinder`s were at play. In particular, when linking from the run-time image a finder is being set up based solely on the module-path. Which in that case only contains the application modules (not the JDK dependencies). So if the `--limit-modules` clause included any JDK modules that the app needs as a dependency the finder would fail because the module specified in the `--limit-modules` clause didn't exist in the finder's look-up space.
>
> [A similar case happens](https://bugs.openjdk.org/browse/JDK-8345573?focusedId=14729247&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14729247) for a regular JDK build where `ALL-MODULE-PATH` is being used together with `--limit-modules`. In that case, the `FindException` is being thrown when the `root` set of modules are attempted to get assembled.
>
> The fix that I'm proposing here is two fold:
>
> 1. Distinguish whether or not we ought to resolve the JDK modules from the run-time image or not.
> 2. Based on that information set up the finders as appropriate and use the same finders when assembling the module root set.
>
> I think this makes for a cleaner implementation and also fixes the `--limit-modules` issue when linking from the run-time image as any finder that is being limited has already been properly set up to include dependencies (if need be).
>
> Testing:
>
> - [ ] GHA
> - [x] jlink tests in `test/jdk/tools/jlink` on a regular JDK build and on a build with `--enable-linkable-runtime`. Both test runs show all tests passing.
>
> Thoughts?
Severin Gehwolf has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
- Merge branch 'master' into jdk-8345573-runtime-link-limit-mods
- Another fix for the incomplete jmods in default mod-path case
- More test changes
- 8345573: Module dependencies not resolved from run-time image when --limit-module is being used
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/22609/files
- new: https://git.openjdk.org/jdk/pull/22609/files/bbdd431b..383d0685
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=22609&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=22609&range=00-01
Stats: 1547 lines in 478 files changed: 698 ins; 646 del; 203 mod
Patch: https://git.openjdk.org/jdk/pull/22609.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/22609/head:pull/22609
PR: https://git.openjdk.org/jdk/pull/22609
More information about the core-libs-dev
mailing list