Details
Description
new ArrayList() and ArrayList.addAll(Collection) assume the passed-in collection will not change between calls.
In the attached test case, a special collection simulates a background thread calling "remove" after the ArrayList has called size(), but before it has called "toArray()". This causes the collection to return a null-padded array, which leads to a corrupt ArrayList. The attached patch fixes the problem.
Attachments
Attachments
Issue Links
- is broken by
-
HARMONY-6681 AbstractCollection.toArray() and AbstractCollection.toArray(T[]) are broken for concurrently modified collections like ConcurrentHashMap.keySet()
- Open