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 22:03:04 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> 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).

nvm -- got confused with `checkFromToIndex` -- your code is better I agree

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

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


More information about the valhalla-dev mailing list