[lworld] Integrated: 8369062: [lworld] Do not allow references to instance fields before a this() invocation

Vicente Romero vromero at openjdk.org
Sun Oct 5 21:04:19 UTC 2025


On Sat, 4 Oct 2025 02:40:02 GMT, Vicente Romero <vromero at openjdk.org> wrote:

> implementation of [1] in valhalla. This means that code like:
> 
> class Inner7 {
>     private int x;
> 
>     public Inner7(byte y) {
>         x = y;  // error can't refer to an instance field before a this() invocation
>         this((int)y);
>     }
>     public Inner7(int x) {
>         this.x = x;
>         super();
>     }
> }
> 
> 
> won't be accepted by javac
> [1] https://bugs.openjdk.org/browse/JDK-8368719

This pull request has now been integrated.

Changeset: 274d5607
Author:    Vicente Romero <vromero at openjdk.org>
URL:       https://git.openjdk.org/valhalla/commit/274d56076260a490ed52df29373216617ddf73ef
Stats:     85 lines in 9 files changed: 50 ins; 16 del; 19 mod

8369062: [lworld] Do not allow references to instance fields before a this() invocation

Reviewed-by: liach

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

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


More information about the valhalla-dev mailing list