> This PR tidies up the DA/DU logic for strict field initialization.
> The main idea is to revisit the changes around `forEachInitializer`, so that 
> the method now accepts a predicate.
> Four predicates are defined:
> * one that selects all static initializers
> * one that selects early instance initializers
> * one that selects late instance initializers
> * one that selects all instance initializers
> 
> Then all calls to `forEachInitializer` are rewired to use the correct 
> predicate. The resulting code is a bit more declarative and easier to follow.
> 
> The main change is that the call to `forEachInitializer` with early instance 
> predicate is moved from `visitApply` to `visitMethod`.
> In other words, to follow the spec correctly, DA/DU state for early 
> initializers must be processed _before_ the first statement in a constructor 
> body that contains a super call.
> 
> This reveals issues in the tests which have been fixed. I have also added a 
> new test that should pass, but was rejected.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Maurizio Cimadamore has updated the pull request with a new target base due to 
a merge or a rebase. The pull request now contains two commits:

 - Merge branch 'lworld' into flow_min
 - Initial push

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

Changes: https://git.openjdk.org/valhalla/pull/2484/files
  Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=2484&range=01
  Stats: 113 lines in 2 files changed: 46 ins; 33 del; 34 mod
  Patch: https://git.openjdk.org/valhalla/pull/2484.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/2484/head:pull/2484

PR: https://git.openjdk.org/valhalla/pull/2484

Reply via email to