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

Vicente Romero vromero at openjdk.org
Sat Nov 15 00:36:38 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 four additional commits since the last revision:

 - 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/e0aa3646..9ba227c5

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

  Stats: 3756 lines in 38 files changed: 1423 ins; 1110 del; 1223 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