JDK-8156497 : Add jar tool support for Multi-Release Modular JARs
  • Type: Sub-task
  • Component: tools
  • Sub-Component: jar
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-05-08
  • Updated: 2016-05-26
  • Resolved: 2016-05-23
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 9
9 b120Fixed
Description
The jar tool needs updating to work with modular JARs that are multi-release JARs.

One area that needs attention is the ConcealedPackages class file attribute, the tool will need to add/replace this in all module-info.class files. The concealed packages should be the same in all versions.

Another issue is the service provider checking, here is how it is broken in jdk9/dev today:

$ find classes/ -type f
classes//META-INF/versions/9/module-info.class
classes//META-INF/versions/9/p/Main.class
classes//META-INF/versions/9/p/Type.class
classes//module-info.class
classes//p/Main.class

$ jar cfm m1.jar mf -C classes .
java.lang.module.InvalidModuleDescriptorException: META-INF.versions.9.p: Invalid package name:  Illegal character at index 4
	at java.lang.module.ModuleInfo.invalidModuleDescriptor(java.base@9-internal/ModuleInfo.java:780)
	at java.lang.module.ModuleInfo.read(java.base@9-internal/ModuleInfo.java:91)
	at java.lang.module.ModuleDescriptor.read(java.base@9-internal/ModuleDescriptor.java:1821)
	at sun.tools.jar.Main.checkServices(jdk.jartool@9-internal/Main.java:1718)
	at sun.tools.jar.Main.run(jdk.jartool@9-internal/Main.java:281)
	at sun.tools.jar.Main.main(jdk.jartool@9-internal/Main.java:1535)