A behavior mismatch in AbstractCollection.toArray(T[] )

Sean Chou zhouyx at linux.vnet.ibm.com
Wed Dec 14 02:42:37 UTC 2011


 Yeah, that is the reason I think a declaimer about "not designed for
concurrent
operation. " in the spec would be a proper choice.


On Tue, Dec 13, 2011 at 10:20 PM, Ulf Zibis <Ulf.Zibis at gmx.de> wrote:

> IMO in 99.8 % this check would be superfluous overhead.
> For those, who want 100 %, they can check and copy in their code.
>
> -Ulf
>
> Am 13.12.2011 14:30, schrieb Sean Chou:
>
>  Sorry for the confuse. By "ok", I mean "compare the size of array which is
>> going to be
>> returned and the size of the specified array, and copy the elements
>> into the specified
>> array if it is larger and return the specified array."
>>
>> Nothing is causing problem for now, I just found a mismatch. I think most
>> guys will
>> just use the returned array without checking if it's the specified one;
>> and
>> this is also
>> why I think it may be possible to modify the behavior without causing
>> problems.
>>
>> And I think modifying ConcurrentHashMap is as dangerous as modifying
>> AbstractCollection
>> if people are relying on implementation, is this right? So it seems we can
>> do nothing
>> to the mismatch now...
>>
>>


-- 
Best Regards,
Sean Chou



More information about the core-libs-dev mailing list