Use of JDK interanl ASM vs external

Remi Forax forax at univ-mlv.fr
Wed Feb 18 11:21:58 UTC 2015


On 02/18/2015 09:40 AM, Ben Evans wrote:
> OK - I'm going to bite.
>
> Why are we doing this? If we're shipping a general purpose bytecode
> manipulation library, then why is it private?
>
> Surely this should become an official, supported & public API?

Currently, the version of ASM shipped with the JDK is a customized 
version compiled directly from the trunk and lightly patched to bubble 
up some internal methods that are not part of the public API.

In jdk8 world, it's an internal API and you should not use it.

In jdk9 world, the classes are integrated into jdk.base module (the one 
that contains packages like java.lang) and the ASM packages are only 
re-exported [1] for nashorn and jfr modules thus not visible by the code 
of an application.

Being a public API means to create an ASM module (or several) and make 
jdk.base depends on this module
without re-exporting the ASM packages.
So the JDK and an application will be able to share the same ASM module.

The issue here is that the JDK module that depends on ASM is jdk.base 
the root of the module graph,
so the root of the module graph is not the root anymore :(

Rémi

[1] http://hg.openjdk.java.net/jdk9/jdk9/file/942895213b68/modules.xml#l221

>
> On Tue, Feb 17, 2015 at 7:58 PM, Remi Forax <forax at univ-mlv.fr> wrote:
>> On 02/17/2015 08:30 PM, Mark Roos wrote:
>>
>> I see that jdk8 now includes a copy of ASM (jdk.internal.org.objectweb.asm).
>>
>> Is it recommended to use that instance vs suppling a copy with my
>> application?
>>
>> thanks
>> mark
>>
>>
>> Hi Mark,
>>
>> These classes are not the one you are looking for :)
>>
>> As the 'internal' in the package name suggest, these classes are intended to
>> be used by the JDK classes only, and not by anyone else.
>> BTW, these classes are not visible anymore in jdk9 (even by reflection).
>>
>> regards,
>> Rémi
>>
>>
>> _______________________________________________
>> mlvm-dev mailing list
>> mlvm-dev at openjdk.java.net
>> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev
>>
> _______________________________________________
> mlvm-dev mailing list
> mlvm-dev at openjdk.java.net
> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev



More information about the mlvm-dev mailing list