[lworld] RFR: 8371382: [lworld] Javac accepts field initializer that refers to a superclass field [v2]

Vicente Romero vromero at openjdk.org
Fri Nov 7 19:18:45 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

Vicente Romero has updated the pull request incrementally with one additional commit since the last revision:

  additional test

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

Changes:
  - all: https://git.openjdk.org/valhalla/pull/1728/files
  - new: https://git.openjdk.org/valhalla/pull/1728/files/e73c8d8a..e0aa3646

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=valhalla&pr=1728&range=01
 - incr: https://webrevs.openjdk.org/?repo=valhalla&pr=1728&range=00-01

  Stats: 4 lines in 2 files changed: 2 ins; 0 del; 2 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