[lworld] RFR: 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 02:13:40 UTC 2025


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();
}

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

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

Changes: https://git.openjdk.org/valhalla/pull/1390/files
  Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=1390&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8351217
  Stats: 33 lines in 2 files changed: 32 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/valhalla/pull/1390.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/1390/head:pull/1390

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


More information about the valhalla-dev mailing list