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

Vicente Romero vromero at openjdk.org
Sat Nov 15 14:37:34 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:

  adding some documentation

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

Changes:
  - all: https://git.openjdk.org/valhalla/pull/1728/files
  - new: https://git.openjdk.org/valhalla/pull/1728/files/65b1b12e..c9a1fee0

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

  Stats: 3 lines in 1 file changed: 2 ins; 0 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