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

Vicente Romero vromero at openjdk.org
Sat Oct 4 02:47:44 UTC 2025


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

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

Commit messages:
 - test chantges
 - Merge branch 'lworld' into JDK-8369062
 - 8369062: [lworld] Do not allow references to instance fields before a this() invocation

Changes: https://git.openjdk.org/valhalla/pull/1659/files
  Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=1659&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8369062
  Stats: 87 lines in 12 files changed: 51 ins; 16 del; 20 mod
  Patch: https://git.openjdk.org/valhalla/pull/1659.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/1659/head:pull/1659

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


More information about the valhalla-dev mailing list