RFR: 8271623: Omit enclosing instance fields from inner classes that don't use it [v2]

Joe Darcy darcy at openjdk.java.net
Tue Aug 3 21:42:31 UTC 2021

On Tue, 3 Aug 2021 18:48:00 GMT, Liam Miller-Cushon <cushon at openjdk.org> wrote:

>> This change omits the synthetic `this$0` field from inner classes that do not access any enclosing instance state.
> Liam Miller-Cushon has updated the pull request incrementally with one additional commit since the last revision:
>   Add a test case with nested inner classes

For the CSR review of this change, I'll request a corpus run be initiated.

Depending on the results of that run, the use of the new code generation idiom here may be triggered on -source/--release level. In other words, always use this$ in -source/--release 17 and earlier and omit it (when possible) on 18 and later.

If you have not done so already, please also run the core reflection regression tests with this change.

While the code generation idioms of javac are not a supported contract, applications can come to reply on them and change this idiom for earlier source levels may by too large of a behavioral compatibility change in that use-case.


PR: https://git.openjdk.java.net/jdk/pull/4966

More information about the compiler-dev mailing list