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

Guoxiong Li gli at openjdk.org
Fri Mar 22 18:36:54 UTC 2024


On Sun, 3 Mar 2024 16:51:40 GMT, Chen Liang <liach at openjdk.org> wrote:

>> 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.
>
> test/langtools/tools/javac/DefiniteAssignment/DA_DUConstructors.java line 1:
> 
>> 1: /*
> 
> Missing copyright header

Please notice the test annotation `@test /nodynamiccopyright/`, it means this file doesn't have a copyright. When the copyright is changed (add or delete lines) in the future, the line number of the compilation result will change, which cause the file `*.out` (`DA_DUConstructors.out` here) need to be adjusted. The `/nodynamiccopyright/` can avoid such unnecessary adjustment.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18088#discussion_r1510529472


More information about the compiler-dev mailing list