RFR: 8043179: Lambda expression can mutate final field [v6]

Archie L. Cobbs duke at openjdk.org
Mon Oct 17 15:45:07 UTC 2022


> (Description revised)
> 
> JDK-8043176 updated the JLS 16.1.10 to describe how within a lambda body, any variables that were DU before the lambda expression must not be considered DU at the start of the lambda block, because arbitrary code could have executed in the meantime:
> 
>>  _No rule allows V to be definitely unassigned before a lambda body. This is by design: a variable that was definitely unassigned before the lambda body may end up being assigned to later on, so we cannot conclude that the variable will be unassigned when the body is executed._
> 
> This fix to `Flow.AssignAnalyzer` follows in a straightforward way: mark all variables as not DU before recursing into the lambda body.

Archie L. Cobbs has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision:

 - Merge branch 'master' into JDK-8043179
 - Fix previously incorrect logic and update unit tests.
 - Merge remote-tracking branch 'upstream/master' into JDK-8043179
 - Fix @author in test to match github username per instructions.
 - Move unit test into a more appropriate subdirectory.
 - Use /nodynamiccopyright/ for "golden file" test per instructions.
 - 8043179: Lambda expression can mutate final field

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/10381/files
  - new: https://git.openjdk.org/jdk/pull/10381/files/703573cf..5d40607c

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=10381&range=05
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=10381&range=04-05

  Stats: 2353 lines in 88 files changed: 1632 ins; 336 del; 385 mod
  Patch: https://git.openjdk.org/jdk/pull/10381.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10381/head:pull/10381

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


More information about the compiler-dev mailing list