[lworld] Integrated: 8351217: [lworld] instance field initializers should be executed immediately upon entry to a non-this-calling constructor

Vicente Romero vromero at openjdk.org
Wed Mar 5 14:08:06 UTC 2025


On Wed, 5 Mar 2025 02:08:34 GMT, Vicente Romero <vromero at openjdk.org> wrote:

> this PR is fixing a bug in javac. For code like:
> 
> value class V {
>     int i = 1;
>     int y;
> 
>     V() {
>         y = 2;
>     }
> }
> 
> javac is generating the constructor as:
> 
> V() {
>     y = 2;
>     i = 1;
>     super();
> }
> 
> it should be:
> 
> V() {
>     i = 1;
>     y = 2;
>     super();
> }

This pull request has now been integrated.

Changeset: 67d181de
Author:    Vicente Romero <vromero at openjdk.org>
URL:       https://git.openjdk.org/valhalla/commit/67d181de2a5916db4451e1894aca77a8d7b6e1c0
Stats:     33 lines in 2 files changed: 32 ins; 0 del; 1 mod

8351217: [lworld] instance field initializers should be executed immediately upon entry to a non-this-calling constructor

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

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


More information about the valhalla-dev mailing list