You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@groovy.apache.org by Remi Forax <fo...@univ-mlv.fr> on 2018/09/02 16:04:12 UTC

Support of Java 11 using ASM 6.2.1 and ASM 7

Hi all,
Java 11 introduces several new forward incompatible features* in the class file.

Currently javac only uses one of them, nestmates [1], which allows to declare that several classes are part of the same nest thus allow access to private members in between them, obviously changing the semantics of the private access for invokevirtual (see [2] if you want more info) if not forward compatible.

Even if NestMates are declared as class attributes, we have decided in ASM to not ignore them if there are present in the bytecode (a class compiled with javac 11) because this change for the VM is far from innocuous, if you scrap those attributes, you get IllegalAccessError laters, so if you use a ClassVisitor configured with the ASM6 API and ASM see a nestmate related attributes (NestHost or NestMembers) it will fail with an UnsuportedOperationException.

Moreover, even if the support of Java 11 will came with ASM7, we have decided to introduce a new experimental API version (currently ASM7_EXPERIMENTAL) which let you parse Java 11 using ASM6 (6.2+), so if you want your favorite language to support Java 11, all visitors need to be upgraded to the api version ASM7_EXPERIMENTAL.
You can also decide as before to wait until we release ASM7 (the first week end after the release of Java as usual, so at the end of September) to use the ASM7 api.  

regards,
Rémi

* see also Constant Dynamic (http://openjdk.java.net/jeps/309) and Preview Feature (http://openjdk.java.net/jeps/12)

[1] http://openjdk.java.net/jeps/181 
[2] https://youtu.be/-k_IicifbxQ?list=PLX8CzqL3ArzVnxC6PYxMlngEMv3W1pIkn

Re: Support of Java 11 using ASM 6.2.1 and ASM 7

Posted by "Daniel.Sun" <su...@apache.org>.
Hi Rémi,

      Thanks a lot for your looking into the issue :-)

Cheers,
Daniel.Sun



-----
Daniel Sun 
Apache Groovy committer 
Blog: http://blog.sunlan.me 
Twitter: @daniel_sun 

--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html

Re: Support of Java 11 using ASM 6.2.1 and ASM 7

Posted by "Daniel.Sun" <su...@apache.org>.
+1




-----
Daniel Sun 
Apache Groovy committer 
Blog: http://blog.sunlan.me 
Twitter: @daniel_sun 

--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html

Re: Support of Java 11 using ASM 6.2.1 and ASM 7

Posted by Paul King <pa...@asert.com.au>.
Thanks Rémi.

Devs,

I'll merge our change in this area (just the ASM_API_VERSION) from Groovy 3
into the GROOVY_2_5_X branch unless there are any objections.

Cheers, Paul.


On Mon, Sep 3, 2018 at 4:06 PM <fo...@univ-mlv.fr> wrote:

>
>
> ------------------------------
>
> *De: *"paulk" <pa...@asert.com.au>
> *À: *"Remi Forax" <fo...@univ-mlv.fr>
> *Cc: *"dev" <de...@groovy.apache.org>
> *Envoyé: *Lundi 3 Septembre 2018 00:26:27
> *Objet: *Re: Support of Java 11 using ASM 6.2.1 and ASM 7
>
> Hi,
> Groovy 3.x snapshots use ASM7_EXPERIMENTAL. For Groovy 2.5.x, the current
> plan (subject to change) is that we were planning on waiting for the ASM 7
> release and doing a new release after that.
>
>
> in that case, perhaps Groovy 2.5.x should reject classfiles V11 and V12
> with an error message instead of having ASM throwing an
> UnsupportedOperationException later, at least until ASM 7 is integrated
>
>
> But, I must admit that I haven't really had a chance to look at the full
> implications of using ASM7_EXPERIMENTAL. If we added that already in 2.5.x
> but don't use any of the new features, is there any backward compatibility
> issues when we then switched to ASM7?
>
>
> Currently no, just replacing ASM7_EXPERIMENTAL by ASM7 is enough and given
> that Java 11 is already in release candidate phase, we do not expect any
> compatibility issues.
> Also, there is no bytecode changes planned for 12 so the latest release of
> ASM 6 (6.2.1) also allows Java 12 bytecode.
>
>
> Cheers, Paul.
>
>
> regards,
> Rémi
>
>
>
> On Mon, Sep 3, 2018 at 2:06 AM Remi Forax <fo...@univ-mlv.fr> wrote:
>
>> Forget to ling to the related bug:
>> https://issues.apache.org/jira/browse/GROOVY-8727
>>
>> cheers,
>> Rémi
>>
>> ----- Mail original -----
>> > De: "Remi Forax" <fo...@univ-mlv.fr>
>> > À: "dev" <de...@groovy.apache.org>
>> > Envoyé: Dimanche 2 Septembre 2018 18:04:12
>> > Objet: Support of Java 11 using ASM 6.2.1 and ASM 7
>>
>> > Hi all,
>> > Java 11 introduces several new forward incompatible features* in the
>> class file.
>> >
>> > Currently javac only uses one of them, nestmates [1], which allows to
>> declare
>> > that several classes are part of the same nest thus allow access to
>> private
>> > members in between them, obviously changing the semantics of the
>> private access
>> > for invokevirtual (see [2] if you want more info) if not forward
>> compatible.
>> >
>> > Even if NestMates are declared as class attributes, we have decided in
>> ASM to
>> > not ignore them if there are present in the bytecode (a class compiled
>> with
>> > javac 11) because this change for the VM is far from innocuous, if you
>> scrap
>> > those attributes, you get IllegalAccessError laters, so if you use a
>> > ClassVisitor configured with the ASM6 API and ASM see a nestmate related
>> > attributes (NestHost or NestMembers) it will fail with an
>> > UnsuportedOperationException.
>> >
>> > Moreover, even if the support of Java 11 will came with ASM7, we have
>> decided to
>> > introduce a new experimental API version (currently ASM7_EXPERIMENTAL)
>> which
>> > let you parse Java 11 using ASM6 (6.2+), so if you want your favorite
>> language
>> > to support Java 11, all visitors need to be upgraded to the api version
>> > ASM7_EXPERIMENTAL.
>> > You can also decide as before to wait until we release ASM7 (the first
>> week end
>> > after the release of Java as usual, so at the end of September) to use
>> the ASM7
>> > api.
>> >
>> > regards,
>> > Rémi
>> >
>> > * see also Constant Dynamic (http://openjdk.java.net/jeps/309) and
>> Preview
>> > Feature (http://openjdk.java.net/jeps/12)
>> >
>> > [1] http://openjdk.java.net/jeps/181
>> > [2]
>> https://youtu.be/-k_IicifbxQ?list=PLX8CzqL3ArzVnxC6PYxMlngEMv3W1pIkn
>>
>
>

Re: Support of Java 11 using ASM 6.2.1 and ASM 7

Posted by fo...@univ-mlv.fr.
> De: "paulk" <pa...@asert.com.au>
> À: "Remi Forax" <fo...@univ-mlv.fr>
> Cc: "dev" <de...@groovy.apache.org>
> Envoyé: Lundi 3 Septembre 2018 00:26:27
> Objet: Re: Support of Java 11 using ASM 6.2.1 and ASM 7

> Hi,
> Groovy 3.x snapshots use ASM7_EXPERIMENTAL. For Groovy 2.5.x, the current plan
> (subject to change) is that we were planning on waiting for the ASM 7 release
> and doing a new release after that.

in that case, perhaps Groovy 2.5.x should reject classfiles V11 and V12 with an error message instead of having ASM throwing an UnsupportedOperationException later, at least until ASM 7 is integrated 

> But, I must admit that I haven't really had a chance to look at the full
> implications of using ASM7_EXPERIMENTAL. If we added that already in 2.5.x but
> don't use any of the new features, is there any backward compatibility issues
> when we then switched to ASM7?

Currently no, just replacing ASM7_EXPERIMENTAL by ASM7 is enough and given that Java 11 is already in release candidate phase, we do not expect any compatibility issues. 
Also, there is no bytecode changes planned for 12 so the latest release of ASM 6 (6.2.1) also allows Java 12 bytecode. 

> Cheers, Paul.

regards, 
Rémi 

> On Mon, Sep 3, 2018 at 2:06 AM Remi Forax < [ mailto:forax@univ-mlv.fr |
> forax@univ-mlv.fr ] > wrote:

>> Forget to ling to the related bug:
>> [ https://issues.apache.org/jira/browse/GROOVY-8727 |
>> https://issues.apache.org/jira/browse/GROOVY-8727 ]

>> cheers,
>> Rémi

>> ----- Mail original -----
>> > De: "Remi Forax" < [ mailto:forax@univ-mlv.fr | forax@univ-mlv.fr ] >
>> > À: "dev" < [ mailto:dev@groovy.apache.org | dev@groovy.apache.org ] >
>> > Envoyé: Dimanche 2 Septembre 2018 18:04:12
>> > Objet: Support of Java 11 using ASM 6.2.1 and ASM 7

>> > Hi all,
>> > Java 11 introduces several new forward incompatible features* in the class file.

>> > Currently javac only uses one of them, nestmates [1], which allows to declare
>> > that several classes are part of the same nest thus allow access to private
>> > members in between them, obviously changing the semantics of the private access
>> > for invokevirtual (see [2] if you want more info) if not forward compatible.

>> > Even if NestMates are declared as class attributes, we have decided in ASM to
>> > not ignore them if there are present in the bytecode (a class compiled with
>> > javac 11) because this change for the VM is far from innocuous, if you scrap
>> > those attributes, you get IllegalAccessError laters, so if you use a
>> > ClassVisitor configured with the ASM6 API and ASM see a nestmate related
>> > attributes (NestHost or NestMembers) it will fail with an
>> > UnsuportedOperationException.

>> > Moreover, even if the support of Java 11 will came with ASM7, we have decided to
>> > introduce a new experimental API version (currently ASM7_EXPERIMENTAL) which
>> > let you parse Java 11 using ASM6 (6.2+), so if you want your favorite language
>> > to support Java 11, all visitors need to be upgraded to the api version
>> > ASM7_EXPERIMENTAL.
>> > You can also decide as before to wait until we release ASM7 (the first week end
>> > after the release of Java as usual, so at the end of September) to use the ASM7
>> > api.

>> > regards,
>> > Rémi

>>> * see also Constant Dynamic ( [ http://openjdk.java.net/jeps/309 |
>> > http://openjdk.java.net/jeps/309 ] ) and Preview
>>> Feature ( [ http://openjdk.java.net/jeps/12 | http://openjdk.java.net/jeps/12 ]
>> > )

>> > [1] [ http://openjdk.java.net/jeps/181 | http://openjdk.java.net/jeps/181 ]
>>> [2] [ https://youtu.be/-k_IicifbxQ?list=PLX8CzqL3ArzVnxC6PYxMlngEMv3W1pIkn |
>> > https://youtu.be/-k_IicifbxQ?list=PLX8CzqL3ArzVnxC6PYxMlngEMv3W1pIkn ]

Re: Support of Java 11 using ASM 6.2.1 and ASM 7

Posted by Paul King <pa...@asert.com.au>.
Hi,

Groovy 3.x snapshots use ASM7_EXPERIMENTAL. For Groovy 2.5.x, the current
plan (subject to change) is that we were planning on waiting for the ASM 7
release and doing a new release after that.

But, I must admit that I haven't really had a chance to look at the full
implications of using ASM7_EXPERIMENTAL. If we added that already in 2.5.x
but don't use any of the new features, is there any backward compatibility
issues when we then switched to ASM7?

Cheers, Paul.


On Mon, Sep 3, 2018 at 2:06 AM Remi Forax <fo...@univ-mlv.fr> wrote:

> Forget to ling to the related bug:
> https://issues.apache.org/jira/browse/GROOVY-8727
>
> cheers,
> Rémi
>
> ----- Mail original -----
> > De: "Remi Forax" <fo...@univ-mlv.fr>
> > À: "dev" <de...@groovy.apache.org>
> > Envoyé: Dimanche 2 Septembre 2018 18:04:12
> > Objet: Support of Java 11 using ASM 6.2.1 and ASM 7
>
> > Hi all,
> > Java 11 introduces several new forward incompatible features* in the
> class file.
> >
> > Currently javac only uses one of them, nestmates [1], which allows to
> declare
> > that several classes are part of the same nest thus allow access to
> private
> > members in between them, obviously changing the semantics of the private
> access
> > for invokevirtual (see [2] if you want more info) if not forward
> compatible.
> >
> > Even if NestMates are declared as class attributes, we have decided in
> ASM to
> > not ignore them if there are present in the bytecode (a class compiled
> with
> > javac 11) because this change for the VM is far from innocuous, if you
> scrap
> > those attributes, you get IllegalAccessError laters, so if you use a
> > ClassVisitor configured with the ASM6 API and ASM see a nestmate related
> > attributes (NestHost or NestMembers) it will fail with an
> > UnsuportedOperationException.
> >
> > Moreover, even if the support of Java 11 will came with ASM7, we have
> decided to
> > introduce a new experimental API version (currently ASM7_EXPERIMENTAL)
> which
> > let you parse Java 11 using ASM6 (6.2+), so if you want your favorite
> language
> > to support Java 11, all visitors need to be upgraded to the api version
> > ASM7_EXPERIMENTAL.
> > You can also decide as before to wait until we release ASM7 (the first
> week end
> > after the release of Java as usual, so at the end of September) to use
> the ASM7
> > api.
> >
> > regards,
> > Rémi
> >
> > * see also Constant Dynamic (http://openjdk.java.net/jeps/309) and
> Preview
> > Feature (http://openjdk.java.net/jeps/12)
> >
> > [1] http://openjdk.java.net/jeps/181
> > [2] https://youtu.be/-k_IicifbxQ?list=PLX8CzqL3ArzVnxC6PYxMlngEMv3W1pIkn
>

Re: Support of Java 11 using ASM 6.2.1 and ASM 7

Posted by Remi Forax <fo...@univ-mlv.fr>.
Forget to ling to the related bug:
https://issues.apache.org/jira/browse/GROOVY-8727

cheers,
Rémi

----- Mail original -----
> De: "Remi Forax" <fo...@univ-mlv.fr>
> À: "dev" <de...@groovy.apache.org>
> Envoyé: Dimanche 2 Septembre 2018 18:04:12
> Objet: Support of Java 11 using ASM 6.2.1 and ASM 7

> Hi all,
> Java 11 introduces several new forward incompatible features* in the class file.
> 
> Currently javac only uses one of them, nestmates [1], which allows to declare
> that several classes are part of the same nest thus allow access to private
> members in between them, obviously changing the semantics of the private access
> for invokevirtual (see [2] if you want more info) if not forward compatible.
> 
> Even if NestMates are declared as class attributes, we have decided in ASM to
> not ignore them if there are present in the bytecode (a class compiled with
> javac 11) because this change for the VM is far from innocuous, if you scrap
> those attributes, you get IllegalAccessError laters, so if you use a
> ClassVisitor configured with the ASM6 API and ASM see a nestmate related
> attributes (NestHost or NestMembers) it will fail with an
> UnsuportedOperationException.
> 
> Moreover, even if the support of Java 11 will came with ASM7, we have decided to
> introduce a new experimental API version (currently ASM7_EXPERIMENTAL) which
> let you parse Java 11 using ASM6 (6.2+), so if you want your favorite language
> to support Java 11, all visitors need to be upgraded to the api version
> ASM7_EXPERIMENTAL.
> You can also decide as before to wait until we release ASM7 (the first week end
> after the release of Java as usual, so at the end of September) to use the ASM7
> api.
> 
> regards,
> Rémi
> 
> * see also Constant Dynamic (http://openjdk.java.net/jeps/309) and Preview
> Feature (http://openjdk.java.net/jeps/12)
> 
> [1] http://openjdk.java.net/jeps/181
> [2] https://youtu.be/-k_IicifbxQ?list=PLX8CzqL3ArzVnxC6PYxMlngEMv3W1pIkn