JDK-8165640 : Enhance jar tool to allow module-info in versioned directories but not in base in modular multi-release jar files
  • Type: Sub-task
  • Component: tools
  • Sub-Component: jar
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-09-07
  • Updated: 2017-02-23
  • Resolved: 2017-02-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10 JDK 9
10Fixed 9 b157Fixed
Description
Let jar tool create a modular multi-release jar file that looks like this:

META-INF/MANIFEST.MF
META-INF/versions/9/module-info.class
p/Foo.class
p/Main.class

Or this:

META-INF/MANIFEST.MF
META-INF/versions/10/module-info.class
p/Foo.class
p/Main.class
META-INF/versions/9/p/Foo.class
META-INF/versions/10/p/Foo.class

In the above, base and versions/9 are not modules but versions/10 is a module
Comments
As things stand, a modular JAR is defined to have a module-info.class in the top-level directory. It's an open question as to how it interacts with the MR JAR support and whether have a module-info.class in the versioned section but not in the base section make any sense. We should not hold updating any of the tools until that discussion point is resolved.
10-09-2016

May need to enhance javac since I believe it opens up base module-info.class to get module name before it reopens jar file at appropriate version. Java currently can't read this since it synthesizes a bogus module descriptor for META-INF.versions.9, but it will be enhanced in the near future -- needs testing. Jdeps and jlink may be affected.
07-09-2016