Proposal: Large arrays
Joseph D. Darcy
Joe.Darcy at Sun.COM
Tue Mar 24 11:07:12 PDT 2009
james lowden wrote:
>> I don't think the source compatibility impact is that
>> large actually. Let's say *all* arrays can potentially
>> be 64-bit now. The existing code that uses an int
>> expression to index into the array will still index into the
>> same element and negative indexes will still cause an
>> exception. Now, how should the length field be set?
>> I'd guess it should saturate to Integer.MAX_VALUE for
>> oversize arrays and a new "long size()" method
>> could be added to return the full length.
>>
>
> This I'd actually prefer over what I proposed (and, based on the response so far and the previous bug, what others would probably like as well); my main concern was not breaking the int "length" field; I'd slightly prefer the long size to be a field rather than a method, but that may just be due to that being how I'm used to obtaining the array size; if there's a compelling reason to use a method rather than a field for this, I'd be curious to hear it.
>
Methods should generally be preferred to fields. A method named "size"
is used in Collections.
-Joe
More information about the coin-dev
mailing list