[lworld] Integrated: 8341061: [lworld] final field initialization bug with instance block initializers

Vicente Romero vromero at openjdk.org
Tue Oct 1 13:22:26 UTC 2024


On Tue, 1 Oct 2024 13:14:38 GMT, Vicente Romero <vromero at openjdk.org> wrote:

> javac is allowing final fields of a value class to be assigned in an instance initialization block. But those are executed after the `super()` invocation, so code like:
> 
> value class V {
>     int f;
>     {
>         f = 1;
>     }
> }
> 
> should be rejected as `f` would be initialized after the implicit `super` invocation

This pull request has now been integrated.

Changeset: 1c354b82
Author:    Vicente Romero <vromero at openjdk.org>
URL:       https://git.openjdk.org/valhalla/commit/1c354b826b7407ea786b67832bd101cf1a278381
Stats:     26 lines in 3 files changed: 14 ins; 1 del; 11 mod

8341061: [lworld] final field initialization bug with instance block initializers

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

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


More information about the valhalla-dev mailing list