The jar tool should validate names of modules in `--validate` mode, especially it should validate the value of an `Automatic-Module-Name` entry in the MANIFEST.MF file.
Validating a modular JAR file that has both an automatic module name MANIFEST.MF entry and a module descriptor with mismatching names, should fail. Running `jar --validate --file c.jar` after the following setup does not fail - but should.
> type MANIFEST.MF
Automatic-Module-Name: b
> type module-info.java
module c {}
> javac module-info.java
> jar --create --file a.jar --manifest MANIFEST.MF
> jar --create --file c.jar --manifest MANIFEST.MF module-info.class
> java --module-path a.jar --describe-module a
a not found
> java --module-path a.jar --describe-module b
b file:///.../a.jar automatic
requires java.base mandated
> java --module-path c.jar --describe-module c
c file:///.../c.jar
requires java.base mandated
Validating a modular JAR file that has both an automatic module name MANIFEST.MF entry and a module descriptor with mismatching names, should fail. Running `jar --validate --file c.jar` after the following setup does not fail - but should.
> type MANIFEST.MF
Automatic-Module-Name: b
> type module-info.java
module c {}
> javac module-info.java
> jar --create --file a.jar --manifest MANIFEST.MF
> jar --create --file c.jar --manifest MANIFEST.MF module-info.class
> java --module-path a.jar --describe-module a
a not found
> java --module-path a.jar --describe-module b
b file:///.../a.jar automatic
requires java.base mandated
> java --module-path c.jar --describe-module c
c file:///.../c.jar
requires java.base mandated