Integrated: 8043179: Lambda expression can mutate final field
Archie L. Cobbs
duke at openjdk.org
Thu Mar 23 16:03:40 UTC 2023
On Wed, 21 Sep 2022 23:03:45 GMT, Archie L. Cobbs <duke at openjdk.org> wrote:
> (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.
This pull request has now been integrated.
Changeset: c00d0885
Author: Archie L. Cobbs <archie.cobbs at gmail.com>
Committer: Vicente Romero <vromero at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/c00d0885ae3c99c0ebacec0bd7de7382ee954dc1
Stats: 35 lines in 5 files changed: 35 ins; 0 del; 0 mod
8043179: Lambda expression can mutate final field
Reviewed-by: vromero
-------------
PR: https://git.openjdk.org/jdk/pull/10381
More information about the compiler-dev
mailing list