RFR: 8271623: Omit enclosing instance fields from inner classes that don't use it
John Rose
john.r.rose at oracle.com
Tue Aug 3 23:47:52 UTC 2021
On Aug 3, 2021, at 12:56 PM, Rafael Winterhalter <rafael.wth at gmail.com<mailto:rafael.wth at gmail.com>> wrote:
I do however think that you must retain the constructor to accept the outer instance, no matter if it is stored in a field or not. Otherwise, a public inner class might change its constructor and introduce a binary incompatible change if a field access of the outer class is removed or added and this class is recompiled independently. If the constructor only stores the field depending on the need to use it or not, the same effect is achieved without risking such API breakage.
Good point. The named inner classes are supposed
to have a predictable shape at the VM level, to make
use of reflection and debuggers a little easier.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20210803/4066a530/attachment.htm>
More information about the compiler-dev
mailing list