RFR: Tweak error when a null-restricted field is missing an initializer

Vicente Romero vromero at openjdk.org
Tue Jan 13 17:27:41 UTC 2026


On Tue, 13 Jan 2026 16:29:30 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> The logic for issuing an error when a strict (instance) field is missing an initializer relies on there being some constructor at the end of which the error is reported.
> 
> But if the constructor is a default constructor, there's no valid position where to report the error.
> 
> To fix this, I looked at how errors for uninitialized final fields. In case of a default constructor the error is reported against the field decl, not the constructor. I've done the same for non-nullable fields.

lgtm

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

Marked as reviewed by vromero (Committer).

PR Review: https://git.openjdk.org/valhalla/pull/1897#pullrequestreview-3656995068


More information about the valhalla-dev mailing list