JDK-8164805 : Fail to create a MR modular JAR with a versioned entry of a concealed package
  • Type: Sub-task
  • Component: tools
  • Sub-Component: jar
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-08-25
  • Updated: 2016-11-04
  • Resolved: 2016-10-25
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 b143Fixed
Related Reports
Duplicate :  
Description
$ find classes mr9 
classes
classes/module-info.class
classes/p
classes/p/Hi.class
classes/p/internal
mr9
mr9/module-info.class
mr9/p
mr9/p/Hi.class
mr9/p/internal
mr9/p/internal/Bar.class

$ jar --create --file mr.jar -C classes . --release 9 -C mr9 .
entry: META-INF/versions/9/p/Hi.class, has a class version incompatible with an earlier version
entry: META-INF/versions/9/p/internal/Bar.class, contains a new public class not found in base entries
invalid multi-release jar file mr.jar deleted

Updated: the empty package in the above example is irrelevant.  The key is that jar tool should allow to add a public class in a concealed package in a versioned entry of a modular JAR.
Comments
It is agreed that this bug should be fixed. A modular MR jar is allowed to add public classes in a concealed package in the versioned entries. jar tool should emit a warning to state that when this modular MR jar is put on the classpath, such MR jar is not a valid MR jar and the public classes in the concealed package in the versioned entries are accessible.
30-09-2016

Actually the ability has never been there, so we are not dropping the ability, we need to add it. From the description in JDK-8165644: jar tool can not build the following legal modular multi-release jar file because the validator won't validate the new public class q.Bar found in the versions/9 directory without a class with the same name in the base directory. The package q is a concealed package. META-INF/ META-INF/MANIFEST.MF module-info.class META-INF/versions/9/module-info.class p/ p/Foo.class p/Main.class META-INF/versions/9/ META-INF/versions/9/p/ META-INF/versions/9/p/Foo.class META-INF/versions/9/q/ META-INF/versions/9/q/Bar.class
28-09-2016

I fail to see what the problem is. Apparently mr9/p/Hi.class was compile with a release number lower than that of classes/p/Hi.class. That's a sanity check as it should not happen (i.e. class/p/Hi.class should be compiled with release 8 or 9 and mr9/p/Hi.class should be compiled with release 9). For the second problem, one can't put a new public class in a versioned section since it creates a new public interface not defined by the base/root area of the jar.
31-08-2016