RFR: 8345259: Disallow ALL-MODULE-PATH without explicit --module-path [v7]

Severin Gehwolf sgehwolf at openjdk.org
Fri Dec 13 14:04:41 UTC 2024


On Thu, 12 Dec 2024 19:17:55 GMT, Mandy Chung <mchung at openjdk.org> wrote:

>> Severin Gehwolf has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 31 commits:
>> 
>>  - Guard test execution
>>  - Merge branch 'master' into jdk-8345259-all-module-path-fix
>>  - More test clean-ups
>>  - Merge two AllModulePath tests
>>  - Better error message with no modules on mod-path and ALL-MODULE-PATH
>>  - Merge branch 'jdk-8345573-runtime-link-limit-mods' into jdk-8345259-all-module-path-fix
>>  - Naming fixes
>>  - Remove too strong assertion
>>  - Test fixes
>>  - Address comments from Mandy
>>  - ... and 21 more: https://git.openjdk.org/jdk/compare/ff85865b...b577b4da
>
> test/jdk/tools/jlink/basic/AllModulePath.java line 220:
> 
>> 218:      */
>> 219:     @Test
>> 220:     public void modulePathWithLimitMods() throws Exception {
> 
> Is this test case different than `testLimitModules` which does
> 
> jlink --output image1 --add-modules ALL-MODULE-PATH --module-path mods --limit-modules m1
> 
> 
> `testAddModules` also tests:
> 
> 
> jlink --output image2 --add-modules m1,test --add-modules ALL-MODULE-PATH --module-path mods --limit-modules java.base

We have:
- `testLimitModules()` limits on a module from the module path, `m1`. It expects `m1` and it's dependencies in the image.
- `testAddModules()` limits on a module dependency, but has modules from the module path added explicitly: `m1` and `test`. Therefore, expects `m1` and `test` as well as there deps in the image.
- `modulePathWithLimitMods()` limits on a module dependency, but doesn't include any other module with the `--add-modules` option. Therefore, only expects `jdk.jfr` and its dependency, `java.base` to be included in the image.

They are all slightly different and it's useful to test all 3 combinations.

> test/jdk/tools/jlink/basic/AllModulePath.java line 250:
> 
>> 248:      */
>> 249:     @Test
>> 250:     public void modulePath() throws Exception {
> 
> Any difference to `testAllModulePath` which does:
> 
> 
> jlink --output image --add-modules ALL-MODULE-PATH --module-path mods

No difference. I've dropped it.

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

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


More information about the core-libs-dev mailing list