On Mon, 16 Dec 2024 18:55:38 GMT, Mandy Chung <mch...@openjdk.org> wrote:

>>> But this would be for a different bug so as to prevent scope-creep.
>> 
>> Filed https://bugs.openjdk.org/browse/JDK-8346299 for this.
>
> jlink --add-modules ALL-MODULE-PATH --limit-modules jdk.jfr --module-path 
> jmods --output all-mods-limit-mods.image
> 
> 
> The set of observable modules only has `java.base` and `jdk.jfr` because of 
> `--limit-modules`.   Hence `com.baz.runtime` from `jmods` is not observable.  
>   `ALL-MODULE-PATH` adds all observable modules found on the relevant module 
> paths are added to the root set.   This matches the run-time behavior.
> 
> 
> $ java --list-modules -p com.baz.runtime.jar --add-modules ALL-MODULE-PATH 
> --limit-modules jdk.jfr
> java.base@25-internal
> jdk.jfr@25-internal

Limiting the observable modules is sometimes useful for testing/debugging and 
to reduce the number of modules resolved when the main module is the unnamed 
module.

@AlanBateman  Is `--limit-modules` needed at link time?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22494#discussion_r1887356122

Reply via email to