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

Ulf Zibis Ulf.Zibis at gmx.de
Tue Dec 13 14:20:17 UTC 2011

IMO in 99.8 % this check would be superfluous overhead.
For those, who want 100 %, they can check and copy in their code.


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

More information about the core-libs-dev mailing list