RFR: 8334252: Verifier error for lambda declared in early construction context [v2]

Archie Cobbs acobbs at openjdk.org
Thu Jun 13 21:57:24 UTC 2024


> When a lambda is declared in an early construction context, any reference to an outer instance must be acquired through the synthetic constructor rather than the synthetic outer instance field, because 'this' is not available yet.
> 
> The code in `LambdaToMethod.java` has logic for this using the `typesUnderConstruction` field, but that logic assumes that the only early construction context that can exist is within a `super()` or `this()` parameter list. While this was true previously, with the "flexible constructors" JEP 482, this is no longer the case.
> 
> So the fix is to update the logic for managing `typesUnderConstruction` to also include any statements prior to `super()` or `this()`.

Archie Cobbs has updated the pull request incrementally with one additional commit since the last revision:

  Address review suggestion.

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/19707/files
  - new: https://git.openjdk.org/jdk/pull/19707/files/5c9e7d07..6aa8a9a1

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=19707&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19707&range=00-01

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/19707.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19707/head:pull/19707

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


More information about the compiler-dev mailing list