RFR: 8345259: Disallow ALL-MODULE-PATH without explicit --module-path [v8]
Severin Gehwolf
sgehwolf at openjdk.org
Mon Dec 16 16:56:39 UTC 2024
On Mon, 16 Dec 2024 13:44:03 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:
> A different question would be what should happen if the module specified in `--limit-modules` is **not** in the dependency graph of ALL-MODULE-PATH modules.
This seems a good candidate for an error as it's unexpected, IMO. I'll add a separate test case which exercises this and add code to prevent this:
$ rm -rf ./build/limit-mods-test && ./build/linux-x86_64-server-release/images/jdk/bin/jlink --add-modules ALL-MODULE-PATH --module-path ./build/jmods --limit-modules jdk.net --verbose --output ./build/limit-mods-test
Error: jdk.net not in module dependency graph, but specified with --limit-modules
The same without limit modules:
$ rm -rf ./build/limit-mods-test && ./build/linux-x86_64-server-release/images/jdk/bin/jlink --add-modules ALL-MODULE-PATH --module-path ./build/jmods --verbose --output ./build/limit-mods-test
Linking based on the current run-time image
com.bar.testmod file:///disk/openjdk/upstream-sources/git/jdk-jdk/./build/jmods/com.bar.testmod.jmod
java.base jrt:/java.base (run-time image)
java.compiler jrt:/java.compiler (run-time image)
jdk.compiler jrt:/jdk.compiler (run-time image)
jdk.internal.opt jrt:/jdk.internal.opt (run-time image)
jdk.jdeps jrt:/jdk.jdeps (run-time image)
jdk.zipfs jrt:/jdk.zipfs (run-time image)
Providers:
jdk.compiler provides com.sun.tools.javac.platform.PlatformProvider used by jdk.compiler,jdk.jdeps
java.base provides java.nio.file.spi.FileSystemProvider used by java.base
jdk.zipfs provides java.nio.file.spi.FileSystemProvider used by java.base
jdk.compiler provides java.util.spi.ToolProvider used by java.base
jdk.jdeps provides java.util.spi.ToolProvider used by java.base
jdk.compiler provides javax.tools.JavaCompiler used by java.compiler
jdk.compiler provides javax.tools.Tool not used by any observable module
A similar - pre-existing - problem exists where `--limit-modules` would be outside the dependency graph of modules specified with `--add-modules`. But this would be for a different bug so as to prevent scope-creep.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22494#discussion_r1887174591
More information about the core-libs-dev
mailing list