ArrayDeque: avoid triggering JDK 1.6 bug in tests
Use System.arraycopy instead of Arrays.copyOfRange to avoid triggering JDK-7174363 bug in copyOfRange. Fix package of ArrayDequeTest
This commit is contained in:
@@ -550,12 +550,17 @@ public class ArrayDeque<E> : AbstractMutableList<E> {
|
||||
|
||||
if (isEmpty()) {
|
||||
structure(head, emptyArray())
|
||||
} else if (head < tail) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
structure(head, elementData.sliceArray(head until tail))
|
||||
return
|
||||
}
|
||||
|
||||
val elements = arrayOfNulls<Any?>(size)
|
||||
if (head < tail) {
|
||||
elementData.copyInto(elements, startIndex = head, endIndex = tail)
|
||||
structure(head, elements)
|
||||
} else {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
structure(head - elementData.size, elementData.sliceArray(head until elementData.size).plus(elements = elementData.sliceArray(0 until tail)))
|
||||
elementData.copyInto(elements, startIndex = head)
|
||||
elementData.copyInto(elements, elementData.size - head, startIndex = 0, endIndex = tail)
|
||||
structure(head - elementData.size, elements)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package collections
|
||||
package test.collections
|
||||
|
||||
import test.collections.behaviors.iteratorBehavior
|
||||
import test.collections.behaviors.listIteratorBehavior
|
||||
|
||||
Reference in New Issue
Block a user