On Fri, 9 Jan 2026 12:28:59 GMT, Maurizio Cimadamore <[email protected]> wrote:
> This PR adds checks in `Attr` so that creation of non-empty null-restricted > arrays w/o an initializer is not allowed. > > The code is very careful in determining situations where null-restrictions on > the array element type are irrelevant, such as: > > * when the array size is a constant zero - `new String![0]` -- as in this > case the restricted array is empty, so there's nothing to initialize > * when one or more dimensions are missing - `new String![10][]` -- as in this > case the outer array (of size 10) is just filled with `null`s, as the inner > array lacks a size > * when one or more intermediate dimensions is the constant zero - `new > String[0][10]` -- as in this case nothing is really created, as the outer > array is empty > > A test has been added to (hopefully) cover all such pesky cases. This pull request has now been integrated. Changeset: 5a435683 Author: Maurizio Cimadamore <[email protected]> URL: https://git.openjdk.org/valhalla/commit/5a435683d9fe15631419669f8cd1249c37b0cdea Stats: 56 lines in 6 files changed: 53 ins; 0 del; 3 mod Add checks to reject creation of non-empty null-restricted arrays w/o initializer Reviewed-by: vromero ------------- PR: https://git.openjdk.org/valhalla/pull/1876
