-
Sub-task
-
Resolution: Fixed
-
P3
-
9
-
b120
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)
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)