Allow ModuleInfoExtender to be used externally

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Allow ModuleInfoExtender to be used externally

Oliver Siegmar
Hello,

I have to create a Java 9 modularized jar file programmatically.

I noticed, that the compiled module-info.class file gets modified (main-class, module-version and modules-hash) by the jar command line tool (using jdk.internal.module.ModuleInfoExtender).

Unfortunately, neither the ModuleInfoExtender itself nor the used asm-lib is exported to allow external use. Is it planned to change this in the final release of Java 9?


I think, it is a bit scary, that the binary version of module-info.class gets manipulated to create a jar file. Having to re-implement this functionality in 3rd party tools (like Ant, Maven, Gradle, etc.) doesn’t make it better ;-)


Bye

Oliver

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Allow ModuleInfoExtender to be used externally

Mandy Chung


On 8/9/17 7:39 AM, Oliver Siegmar wrote:
> Hello,
>
> I have to create a Java 9 modularized jar file programmatically.
>
> I noticed, that the compiled module-info.class file gets modified (main-class, module-version and modules-hash) by the jar command line tool (using jdk.internal.module.ModuleInfoExtender).
>
> Unfortunately, neither the ModuleInfoExtender itself nor the used asm-lib is exported to allow external use. Is it planned to change this in the final release of Java 9?

ModuleInfoExtender is JDK internal API and not planned to be
exported/opened.  New version of ASM supports module-info.class. You can
probably try out ASM 6 alpha version for now.
>
> I think, it is a bit scary, that the binary version of module-info.class gets manipulated to create a jar file. Having to re-implement this functionality in 3rd party tools (like Ant, Maven, Gradle, etc.) doesn’t make it better ;-)

To be clear, the jar tool does not change Module attribute but it may
add optional attributes.   I don't see how it can be scary to you.

Mandy

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Allow ModuleInfoExtender to be used externally

Oliver Siegmar

> On 8/9/17 7:35 PM, mandy chung wrote:
> ModuleInfoExtender is JDK internal API and not planned to be exported/opened.  New version of ASM supports module-info.class. You can probably try out ASM 6 alpha version for now.

Thank you for clarifying. So, an external library (ASM) is required to build modularized Jar files — the JDK offers no built-in support for that (except the JAR command line tool). I’m very surprised as I think it is JDKs job to offer this functionality to 3rd party tools (as it does it with the compiler and other aspects of building and packaging Java applications).


>> I think, it is a bit scary, that the binary version of module-info.class gets manipulated to create a jar file. Having to re-implement this functionality in 3rd party tools (like Ant, Maven, Gradle, etc.) doesn’t make it better ;-)
>
> To be clear, the jar tool does not change Module attribute but it may add optional attributes.   I don't see how it can be scary to you.

Well, it remembers me of the pre-XML era and all the problems we had that time with binary data and protocols — this is why it scares me. I bet, that the module-info would be a XML file if Jigsaw would have been released in 2000 :-). Anyway, forcing 3rd party tools to re-implement this mechanism is asking for trouble IMO.


- Oliver

Loading...