RFR: 8375433: jar should validate automatic module names [v2]
Christian Stein
cstein at openjdk.org
Tue Jan 27 11:49:53 UTC 2026
On Mon, 26 Jan 2026 18:22:32 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
>> Christian Stein has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Address review comments
>
> src/jdk.jartool/share/classes/sun/tools/jar/Validator.java line 480:
>
>> 478: errorAndInvalid(formatMsg("error.validator.manifest.invalid.automatic.module.name", automaticModuleName));
>> 479: }
>> 480: if (md == null || automaticModuleName.equals(md.name())) {
>
> Realizing this now, but this is only checking the top-level `module-info.class`, not any of the ones under the `META-INF/versions` directories. e.g. `checkModuleDescriptor` is also being called for each versioned `module-info.class` file. Is that something that we should also be doing for this check?
The `this.md` field is initialized (by `checkModuleDescriptor(MODULE_INFO);` from within the constructor) to the "base" compiled module descriptor. It also includes this comment:
> ```
> // Initialize the base md if it's not yet. A "base" md can be either the
> // root module-info.class or the first versioned module-info.class
> ```
With that in place, and the consistency checks being performed in `checkModuleDescriptor(MODULE_INFO);`, we are good.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29316#discussion_r2731623055
More information about the core-libs-dev
mailing list