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

Vicente Romero vromero at openjdk.org
Sat Nov 15 14:28:16 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 with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision:

 - adding test
 - Merge branch 'lworld' into JDK-8371382
 - fixing bug
 - Merge branch 'lworld' into JDK-8371382
 - additional test
 - 8371382: [lworld] Javac accepts field initializer that refers to a superclass field

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

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

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

  Stats: 798 lines in 21 files changed: 397 ins; 239 del; 162 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