RFR: 8043179: Lambda expression can mutate final field [v5]
Archie L. Cobbs
duke at openjdk.org
Fri Oct 14 16:38:38 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 six additional commits since the last revision:
- 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/b7bc0b6d..703573cf
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=10381&range=04
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=10381&range=03-04
Stats: 58115 lines in 1630 files changed: 33001 ins; 16475 del; 8639 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