[lworld] RFR: 8371382: [lworld] Javac accepts field initializer that refers to a superclass field
Vicente Romero
vromero at openjdk.org
Fri Nov 7 19:14:22 UTC 2025
Javac is accepting this code:
abstract value class ValueParent {
int b = 5;
}
value class ValueClass extends ValueParent {
int a = b;
}
This is not allowed as in value classes field initializers will run in the prologue phase where references to super class fields are forbidden
TIA
-------------
Commit messages:
- 8371382: [lworld] Javac accepts field initializer that refers to a superclass field
Changes: https://git.openjdk.org/valhalla/pull/1728/files
Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=1728&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8371382
Stats: 21 lines in 3 files changed: 12 ins; 8 del; 1 mod
Patch: https://git.openjdk.org/valhalla/pull/1728.diff
Fetch: git fetch https://git.openjdk.org/valhalla.git pull/1728/head:pull/1728
PR: https://git.openjdk.org/valhalla/pull/1728
More information about the valhalla-dev
mailing list