Module name as new Manifest Entry
pbenedict at apache.org
Fri Mar 11 20:25:52 UTC 2016
For consideration by the EG:
Based on some discussion , there is at least one tool like the Maven
Compiler Plugin that only requires a Java 1.6 runtime. That means there is
no native way for it to access the module name in a Java 1.9 JAR. One
possible solution is to use a third-party class reader which knows how to
interpret the new class file format.
On the other hand, Java has supported reading the Manifest file since
version 1.2. This API is available to older Java runtimes. If Java 9
allowed a new Manifest entry for the module name, older runtimes could then
easily retrieve the module name using existing API.
Furthermore, it would allow library providers who still support pre-Java 9
to provide a de facto module name when dropped in as an "automatic module"
. I personally don't find it tenable that artifacts in the Maven
repository will ever be renamed to have a decent working module name that's
usable in "automatic module" mode.
PS: I am not proposing the Manifest entry replace the module name in
module-info.java. This is only to ease migration of legacy libraries in
"automatic module" mode.
More information about the jpms-spec-comments