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

Archie L. Cobbs duke at openjdk.org
Wed Oct 19 15:08:51 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 incrementally with one additional commit since the last revision:

  Remove @author tags from tests.

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/10381/files
  - new: https://git.openjdk.org/jdk/pull/10381/files/06b39a59..b1d5b3c9

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

  Stats: 2 lines in 2 files changed: 0 ins; 2 del; 0 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