Module name as new Manifest Entry

Paul Benedict pbenedict at apache.org
Fri Mar 11 20:46:50 UTC 2016


Dear EG, I would like to make an addendum and correction.

While a new Manifest entry would allow legacy library authors to control
the module name as an easy patch update, it doesn't help what I first
mentioned in the opening paragraph. Even for new Java 1.9 libraries, tools
like the Maven Compiler Plugin, which still require a minimum 1.6 runtime,
would not have any native means to access the module name. With that said,
I was driving at this requirement: the new Manifest entry should
*complement* the module-info.java module name.

The entry is meant to be informational. It doesn't determine the module
name; it merely duplicates it for easy tooling purposes. The two should
never be different. If they are different, it could be an error
(bikeshedding opportunity).

Example:
Manifest-Version: 1.0
Created-By: 9.0.0
Module-Name: org.baz.qux

Cheers,
Paul

On Fri, Mar 11, 2016 at 2:25 PM, Paul Benedict <pbenedict at apache.org> wrote:

> For consideration by the EG:
>
> Based on some discussion [1], 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"
> [2]. 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.
>
> [1]
> http://mail.openjdk.java.net/pipermail/jigsaw-dev/2016-March/006632.html
> [2]
> http://mail.openjdk.java.net/pipermail/jigsaw-dev/2016-March/006683.html
>
> Cheers,
> Paul
>



More information about the jpms-spec-comments mailing list