Integrated: javac should not place initializers of null restricted fields before the super invocation

Vicente Romero vromero at openjdk.org
Sat Jan 31 00:52:14 UTC 2026


On Thu, 29 Jan 2026 01:34:35 GMT, Vicente Romero <vromero at openjdk.org> wrote:

> 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.

This pull request has now been integrated.

Changeset: 187ac64b
Author:    Vicente Romero <vromero at openjdk.org>
URL:       https://git.openjdk.org/valhalla/commit/187ac64b57760263124f6bf8fcd3810a39d18701
Stats:     352 lines in 15 files changed: 197 ins; 33 del; 122 mod

javac should not place initializers of null restricted fields before the super invocation

Reviewed-by: liach

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

PR: https://git.openjdk.org/valhalla/pull/1990


More information about the valhalla-dev mailing list