On Tue, 17 Dec 2024 11:45:56 GMT, Severin Gehwolf <sgehw...@openjdk.org> wrote:
>> Please review this extension to #22609 which now disallows `ALL-MODULE-PATH` >> without explicit `--module-path` option or a non-existent module path. In >> addition, this fixes a bug mentioned in #22609 when `ALL-MODULE-PATH` and >> `--limit-modules` are used in combination. It failed earlier and passes now >> due to alignment of `ModuleFinder`s. With this patch JEP 493 enabled builds >> and regular JDK builds behave the same in terms of `ALL-MODULE-PATH`. >> >> When an explicit module path is being added, there is no difference. All >> modules on that path will be added as roots. Tests have been added for the >> various cases and existing tests updated to allow for them to run on JEP 493 >> enabled builds. Thoughts? >> >> Testing: >> - [x] GHA, `test/jdk/tools/jlink` (all pass) >> - [x] Added jlink test. > > Severin Gehwolf has updated the pull request incrementally with one > additional commit since the last revision: > > Fix comments See below as my response to your question but I take back this proposal. I'm ok to proceed as is and revisit this issue in the future. > So this means `--limit-modules` has no meaning when `ALL-MODULE-PATH` is > specified. It will be ignored. I can't tell how it will be ignored. Maybe missing something. The transitive dependences of the modules specified to `--limit-modules` plus the modules specified to `--add-modules` are observable. See the implementation of `limitFinder` method which do not compute the dependences of the modules specified to `--add-modules`. > * `jlink --add-modules ALL-MODULE-PATH --module-path MP --limit-modules > java.base` This jlink command should fail as `jdk.net` required by `b` is not observable. > Note that one pre-existing test case verifies case (2) above. It asserts that > the modules in the image only include the transitive closure of `b` (not > including `a`, `c`). This would then change to also include `a` and `c`. Yes, I'm aware of that and needs discussion. > A corollary of it would be that if the module path includes the `jmods` > folder, it would always include all JDK modules plus any that are observable > outside that set without any means to cut the list of included modules. JDK modules are not on `--module-path` by default. So they will not be included. If `--module-path $JAVA_HOME/jmods` is specified with `--add-modules ALL-MODULE-PATH`, it explicitly requests to add all packaged modules from `jmods` directory. ------------- PR Comment: https://git.openjdk.org/jdk/pull/22494#issuecomment-2549780804