On Tue, 17 Dec 2024 22:24:47 GMT, Mandy Chung <mch...@openjdk.org> wrote:
> The combination of ALL-MODULE-PATH and `--limit-modules` indeed needs time to > discuss. As the tests work with the current fix, we should separate this > issue and revisit this in the future. Thanks, yes that would be good. > I have reviewed the version before the commit to check proactively any > dependence not observable > [bfac446](https://github.com/openjdk/jdk/pull/22494/commits/bfac44659e7219afe472d0e61735df119065796d). > The resolution will fail anyway and this eager verification is not needed > IMO. What do you think? Unfortunately resolution won't fail. The `finder` returned by `limitFinder()` will include the module not in the dep tree. Remember, that the default module path has been added (or the system modules). So all JDK modules will be found. Since `--limit-modules` is not empty, modules in `ALL_MODULE_PATH` will not be passed as the limit modules, but the explicit value that the user requested. Therefore, the only root will be the ones from `--limit-modules` which is unexpected. Example: $ jmod describe build/jmods/com.baz.runtime.jmod com.baz.runtime exports com.baz.runtime exports com.baz.runtime.com.foo.bar requires java.base mandated requires jdk.jfr main-class com.baz.runtime.Main $ jlink --add-modules ALL-MODULE-PATH --module-path build/jmods --limit-modules jdk.net --output ./build/test-img --verbose java.base file:///disk/openjdk/upstream-sources/git/jdk-jdk/build/jmods-jdk/jmods/java.base.jmod jdk.net file:///disk/openjdk/upstream-sources/git/jdk-jdk/build/jmods-jdk/jmods/jdk.net.jmod Providers: java.base provides java.nio.file.spi.FileSystemProvider used by java.base Note that we cannot distinguish this case from another - wanted (as per a pre-existing test) - use case, unless we pro-actively resolve the config: $ bin/jlink --add-modules ALL-MODULE-PATH --module-path build/mods --output ./build/test-img --verbose java.base file:///disk/openjdk/upstream-sources/git/jdk-jdk/build/jmods-jdk/jmods/java.base.jmod m1 file:///build/mods/m1/ test file:///build/mods/test/ Providers: java.base provides java.nio.file.spi.FileSystemProvider used by java.base vs. $ bin/jlink --add-modules ALL-MODULE-PATH --module-path build/mods --limit-modules m1 --output ./build/test-img --verbose java.base file:///disk/openjdk/upstream-sources/git/jdk-jdk/build/jmods-jdk/jmods/java.base.jmod m1 file:///build/mods/m1/ Providers: java.base provides java.nio.file.spi.FileSystemProvider used by java.base So I think this is needed for now. ------------- PR Comment: https://git.openjdk.org/jdk/pull/22494#issuecomment-2551052399