RFR: 8260892: Compilation fails: lambda parameter not visible in body when generics involved

Vicente Romero vromero at openjdk.org
Tue Aug 2 00:02:30 UTC 2022


This bug is being produced because as the diamond expression can't be attributed until the inference has been done. A listener is registered in the corresponding inference context but the way the current environment is being copied into `dupLocalEnv` produces a copy that shares info with the outer lambda expression. The lambda expression removes the argument from the shared scope before the listener is fired and thus the error. The proposal is to use a different way to copy the environment into `dupLocalEnv` by producing a brand new scope.

TIA

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

Commit messages:
 - 8260892: Compilation fails: lambda parameter not visible in body when generics involved

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

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


More information about the compiler-dev mailing list