RFR: Updated ArrayCreation factories and bootstraps

Dan Smith dlsmith at openjdk.org
Fri Jan 9 22:36:53 UTC 2026


On Fri, 9 Jan 2026 20:29:35 GMT, Dan Smith <dlsmith at openjdk.org> wrote:

> Added revised bootstrap and factories to ArrayCreation. Threaded through modifiers as much as possible. Added a branch in Array.newInstance to create null-checked arrays where currently supported by the VM.
> 
> Rewrote ArrayCreationTest to exercise all factories and bootstraps, and to make some use of modifiers.

src/java.base/share/classes/java/lang/reflect/Array.java line 148:

> 146:         if (sourceLength > 0) {
> 147:             Objects.checkIndex(sourceOffset, sourceLength);
> 148:         } else if (sourceOffset != 0) {

This validation logic is confusing to me—is it ok just to call `checkFromIndexSize`?

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1879#discussion_r2677539620


More information about the valhalla-dev mailing list