On Fri, 9 Jan 2026 20:30:34 GMT, Dan Smith <[email protected]> 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

Reply via email to