RFR: 8345185: Some tests in test/jdk/tools/jpackage fail with a JDK without JMODs

Severin Gehwolf sgehwolf at openjdk.org
Fri Dec 13 16:17:36 UTC 2024


On Tue, 10 Dec 2024 17:14:32 GMT, Mandy Chung <mchung at openjdk.org> wrote:

> Can you clarify how `jdk.jpackage` and `jdk.jlink` are included in `ALL-DEFAULT`? They do not have unqualified exports and hence they are not in the default set of root modules. They are service providers of `ToolProvider`. However, JEP 392 https://openjdk.org/jeps/392#Runtime-images specifies that `jpackage` by default does not include `--bind-services`.

@mlchung Let me try to answer this.

When a user executes a `jpackage` command like this:


jpackage --dest test/output2 --name JLinkOptionsTest --input test/input --type app-image --module-path ./test/input --main-jar hello.jar --main-class com.other.Hello


Then `JLinkBundlerHelper` is involved and is being called with set `{ ALL-DEFAULT }` in [JLinkBundlerHelper.createModuleList()](https://github.com/openjdk/jdk/blob/266e3d0decc09b9c17c455e2c754cd39114fa31a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/JLinkBundlerHelper.java#L126-L155) as the `addModules` argument.

This method, in turn, calls `JLinkBundlerHelper.getDefaultModules()` which uses `Configuration.empty().resolveAndBind()` which performs the service binding. This pulls in `jdk.jlink`.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/22644#issuecomment-2541788506


More information about the core-libs-dev mailing list