[jdk21u-dev] RFR: 8322809: SystemModulesMap::classNames and moduleNames arrays do not match the order

Severin Gehwolf sgehwolf at openjdk.org
Fri Nov 29 10:27:45 UTC 2024


On Thu, 28 Nov 2024 10:52:17 GMT, Goetz Lindenmaier <goetz at openjdk.org> wrote:

> Resolved SystemModulesPlugin.java due to context (ClassFile.of() <--> Classfile) 
> 
> The patch is based on the commit to 23, the version for 22/22.0.1 is identical.
> 
> I can reproduce the error with the test, and the patch fixes the issue. 
> 
> I had to adapt the tests because "8317620: Build JDK tools with ModuleMainClass attribute" is missing in 21.
> jdk.jfr has no main, so I exclude it from the tests.

test/jdk/tools/jlink/plugins/SystemModuleDescriptors/src/net.foo/module-info.java line 25:

> 23: 
> 24: module net.foo {
> 25:     requires jdk.jfr;

Not needed if there is no main class in that module.

test/jdk/tools/jlink/plugins/SystemModuleDescriptors/src/net.foo/net/foo/Main.java line 44:

> 42:                 ModuleFinder.ofSystem().find(mn).get().descriptor().mainClass()
> 43:                         .orElseThrow(() -> new RuntimeException(mn + " no main class"))
> 44:         );

The test needs at least 2 main classes in modules (the original review suggests it's adding `jdk.jfr` so that there are 4). I suggest to remove the `jdk.jfr` module if it doesn't include a main class. The dep on `jdk.jfr` in `net.foo`'s module can go away.

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

PR Review Comment: https://git.openjdk.org/jdk21u-dev/pull/1189#discussion_r1863302655
PR Review Comment: https://git.openjdk.org/jdk21u-dev/pull/1189#discussion_r1863301896


More information about the jdk-updates-dev mailing list