RFR: 8345438: Invalid error for return in early construction context lambda

Chen Liang liach at openjdk.org
Wed Dec 4 02:41:42 UTC 2024


On Wed, 4 Dec 2024 02:19:24 GMT, Archie Cobbs <acobbs at openjdk.org> wrote:

> The "Flexible Constructors" JEP feature allows statements to appear before a `super()` invocation, but some restrictions, one of which is that `return` is not allowed. The compiler check for this was being too strict in that it was incorrectly disallowing a `return` statement that was nested inside a lambda, which is OK.
> 
> Please review this patch to the `SuperThisChecker` which fixes this.

Since those checks were not initialized correct for lambda nesting at all, is there any other implied effects of missing these state initializations? Is there any scenario that is erroneously allowed in a lambda, or any other scenario that is erroneously rejected in a lambda? Would be nice to include them in the test if there is any.

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

PR Comment: https://git.openjdk.org/jdk/pull/22531#issuecomment-2516043143


More information about the compiler-dev mailing list