You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@groovy.apache.org by Bo Zhang <bo...@gradle.com> on 2019/05/22 02:23:51 UTC
Missing ACC_PRIVATE flag in generated private inner class bytecode
Hi dear Groovy developers,
Today I noticed that Groovy seems not to set correct access flag for private inner classes. When I’m compiling (Groovy 2.5.4)
```
public class ToolImpl {
private class Thing {
public long v;
}
}
```
The generated inner classes attribute is missing ACC_PRIVATE:
Comparing with the bytecode generated by javac, it’s correctly set:
Reference: https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.6 <https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.6>
Is this intentional?
Bo Zhang
Software Engineer
Gradle Inc.
W. gradle.com <https://gradle.com/>
Re: Missing ACC_PRIVATE flag in generated private inner class
bytecode
Posted by Bo Zhang <zh...@gmail.com>.
Thank you very much @Paul for the guidance. I’ll take a look to see if I can help.
> On 22 May 2019, at 12:51, Paul King <pa...@asert.com.au> wrote:
>
> Hi Bo Zhang,
>
> I believe this is related to this rather old PR:
> https://github.com/apache/groovy/pull/648 <https://github.com/apache/groovy/pull/648>
>
> So, that change was intentional at one point for Android but I suspect possibly only needed for an interim period and possibly no longer relevant. We haven't had anyone who has tested whether applying the change breaks Android, so we have left the existing code in place. It would be great if someone could find some time to test that.
>
> Cheers, Paul.
>
>
> On Wed, May 22, 2019 at 2:46 PM Bo Zhang <bo@gradle.com <ma...@gradle.com>> wrote:
> Hi dear Groovy developers,
>
> Today I noticed that Groovy seems not to set correct access flag for private inner classes. When I’m compiling (Groovy 2.5.4)
>
> ```
> public class ToolImpl {
> private class Thing {
> public long v;
> }
> }
> ```
>
> The generated inner classes attribute is missing ACC_PRIVATE:
>
> <PastedGraphic-4.png>
>
> Comparing with the bytecode generated by javac, it’s correctly set:
>
> <PastedGraphic-5.png>
>
> Reference: https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.6 <https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.6>
>
> Is this intentional?
>
>
> <Em...@2x.png>
> Bo Zhang
> Software Engineer
> Gradle Inc.
> W. gradle.com <https://gradle.com/>
>
Re: Missing ACC_PRIVATE flag in generated private inner class bytecode
Posted by Paul King <pa...@asert.com.au>.
Hi Bo Zhang,
I believe this is related to this rather old PR:
https://github.com/apache/groovy/pull/648
So, that change was intentional at one point for Android but I suspect
possibly only needed for an interim period and possibly no longer relevant.
We haven't had anyone who has tested whether applying the change breaks
Android, so we have left the existing code in place. It would be great if
someone could find some time to test that.
Cheers, Paul.
On Wed, May 22, 2019 at 2:46 PM Bo Zhang <bo...@gradle.com> wrote:
> Hi dear Groovy developers,
>
> Today I noticed that Groovy seems not to set correct access flag for
> private inner classes. When I’m compiling (Groovy 2.5.4)
>
> ```
> public class ToolImpl {
> private class Thing {
> public long v;
> }
> }
> ```
>
> The generated inner classes attribute is missing ACC_PRIVATE:
>
>
> Comparing with the bytecode generated by javac, it’s correctly set:
>
>
> Reference:
> https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.6
>
> Is this intentional?
>
>
>
> *Bo Zhang*
> Software Engineer
> Gradle Inc.
> W. gradle.com
>
>