RFR: 8336786: VerifyError with lambda capture and enclosing instance references [v3]

Liam Miller-Cushon cushon at openjdk.org
Fri Jul 19 17:32:51 UTC 2024


On Fri, 19 Jul 2024 17:08:51 GMT, Liam Miller-Cushon <cushon at openjdk.org> wrote:

>> Hi, please consider this fix for [JDK-8336786](https://bugs.openjdk.org/browse/JDK-8336786). After [JDK-8334037](https://bugs.openjdk.org/browse/JDK-8334037) the handling of capturing `this` in lambdas does not handle synthetic `this` variables declared in supertypes in different packages. This change adjusts the lowering of `this` references to be owned by the enclosing class, instead of the superclass, so they are handle correctly be the capture logic in `capturedDecl` in `LambdaToMethod`.
>
> Liam Miller-Cushon has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Remove unused subclass test

Thanks, switching to `clazz.isSubClass(sym.enclClass(), types)` in LambdaToMethod sounds good, it makes sense that the previous subclass check was a no-op and the more precise membership test shouldn't be necessary after Lower.

To double-check, it sounds like you're leaning towards also keeping the change to `makeOwnerThis`, even though it isn't required with the change to the subclass check in LambdaToMethod?

-------------

PR Comment: https://git.openjdk.org/jdk/pull/20259#issuecomment-2239725362


More information about the compiler-dev mailing list