RFR: javac should not place initializers of null restricted fields before the super invocation [v2]
Vicente Romero
vromero at openjdk.org
Thu Jan 29 14:46:58 UTC 2026
> javac is automatically placing the initializers of null restricted fields before the super invocation. This is incorrect, null restricted fields are not strict and those initializers should be placed after the super. But javac will check that null restricted fields have been initialized before a super invocation. This implies that null restricted fields should not have initializers and users should manually initialize them in all the constructors and before explicit super invocations.
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 two additional commits since the last revision:
- Merge branch 'bworld' into non.null.initializers.run.after.super
- initializers of non null fields are placed after super
-------------
Changes:
- all: https://git.openjdk.org/valhalla/pull/1990/files
- new: https://git.openjdk.org/valhalla/pull/1990/files/f8653abf..9302e13a
Webrevs:
- full: https://webrevs.openjdk.org/?repo=valhalla&pr=1990&range=01
- incr: https://webrevs.openjdk.org/?repo=valhalla&pr=1990&range=00-01
Stats: 156 lines in 3 files changed: 119 ins; 33 del; 4 mod
Patch: https://git.openjdk.org/valhalla/pull/1990.diff
Fetch: git fetch https://git.openjdk.org/valhalla.git pull/1990/head:pull/1990
PR: https://git.openjdk.org/valhalla/pull/1990
More information about the valhalla-dev
mailing list