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

Archie Cobbs acobbs at openjdk.org
Wed Dec 4 02:24:20 UTC 2024


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.

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

Commit messages:
 - Allow 'return' in a lambda declared in an early construction context.

Changes: https://git.openjdk.org/jdk/pull/22531/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=22531&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8345438
  Stats: 66 lines in 3 files changed: 65 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/22531.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/22531/head:pull/22531

PR: https://git.openjdk.org/jdk/pull/22531


More information about the compiler-dev mailing list