RFR: 8322809: SystemModulesMap::classNames and moduleNames arrays do not match the order

Mandy Chung mchung at openjdk.org
Tue Jan 9 17:12:29 UTC 2024


On Tue, 9 Jan 2024 10:06:29 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> One optimization of Jlink SystemModulesPlugin pre-resolves the module graph for modules with a main class.  It stores the name of the initial module and the generated `SystemModules` class name in two arrays that can be obtained from `SystemModulesMap::moduleNames` and `SystemModulesMap::classNames`.   The elements in the array returned by `classNames()` are supposed to correspond to the elements in the array returned by `moduleNames()`.    However, the implementation sorts both arrays by the value of the elements. 
>> 
>> This fix is simple and write the correct class names and not to sort the values separately.
>
> test/jdk/tools/jlink/plugins/SystemModuleDescriptors/src/com.foo/module-info.java line 25:
> 
>> 23: 
>> 24: module com.foo {
>> 25:     requires jdk.httpserver;
> 
> This `requires` means the run-time image created by the test will have 3 modules with main classes. It needs a minimum of 2 so this dependency is okay.

Yes and `net.foo` requires `jdk.jfr` which also has a main class.  The run-time image created by this test has 4 modules.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17316#discussion_r1446377152


More information about the core-libs-dev mailing list