RFR: 8325805: Compiler Implementation for Flexible Constructor Bodies (Second Preview) [v4]

Archie Cobbs acobbs at openjdk.org
Wed Apr 17 17:54:14 UTC 2024


> This patch changes the compiler to allow constructors to make assignments to fields prior to the `super()` invocation, i.e., in the pre-construction context.  This is part of the work associated with [JDK-8325803 - Flexible Constructor Bodies (Second Preview)](https://bugs.openjdk.org/browse/JDK-8325803).
> 
> This patch is based the relevant bits from @vicente-romero-oracle's commit [1b99b5cf](https://github.com/openjdk/valhalla/commit/1b99b5cfd9a5d484b9e7bdfc284daad9ad6535bf) to the valhalla repo.

Archie Cobbs has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 18 commits:

 - Merge branch 'master' into JDK-8325805
 - Disallow assignments to fields with initializers in constructor prologues.
 - Merge branch 'master' into JDK-8325805
 - Merge branch 'master' into JDK-8325805
 - Fix cut & paste of bug ID and summary.
 - Avoid possible unwanted side effects from method Symbol.flags().
 - Add a few more test cases.
 - Fix bug where early assignments in lambda's were being allowed.
 - Add some more allowed assignment test cases.
 - Add test case for early assignment within a lambda.
 - ... and 8 more: https://git.openjdk.org/jdk/compare/06462847...b8b12f62

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

Changes: https://git.openjdk.org/jdk/pull/18088/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=18088&range=03
  Stats: 413 lines in 11 files changed: 408 ins; 0 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/18088.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18088/head:pull/18088

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


More information about the compiler-dev mailing list