harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Zhou <zhoukevi...@gmail.com>
Subject Re: [jira] Created: (HARMONY-6145) [classlib][luni] java.lang.LinkedList.addAll(Collection<? extends E> collection) runs into endless loop
Date Fri, 10 Apr 2009 08:21:56 GMT
I have investigated this defect.
This problem happens on two methods [1][2] of java.lang.LinkedList class.
Initialize a LinkedList and add element at the last position. Then adding
this linkedList to itself will trigger a endless loop.

The root cause is that the implementation of the above addAll methods adds
elements directly from linkList itself which will also change the added
It should transfer the added collection into an array, then add elements
from that array rather than directly from the linkList itself.

[1] public boolean addAll(Collection<? extends E> c)
[2] public boolean addAll(int index, Collection<? extends E> c)

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message