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

Maurizio Cimadamore mcimadamore at openjdk.org
Tue Jan 13 17:30:17 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.

This pull request has now been integrated.

Changeset: 25483b53
Author:    Maurizio Cimadamore <mcimadamore at openjdk.org>
URL:       https://git.openjdk.org/valhalla/commit/25483b53b0dfb2d3efedd6c82927034237dd4fdd
Stats:     47 lines in 5 files changed: 34 ins; 6 del; 7 mod

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

Reviewed-by: vromero

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

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


More information about the valhalla-dev mailing list