RFR: Updated ArrayCreation factories and bootstraps
Maurizio Cimadamore
mcimadamore at openjdk.org
Fri Jan 9 22:36:54 UTC 2026
On Fri, 9 Jan 2026 20:30:34 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`?
no -- if you do that the check will fail for empty arrays (e.g. length == 0).
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1879#discussion_r2677743518
More information about the valhalla-dev
mailing list