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()) {
|
if (isEmpty()) {
|
||||||
structure(head, emptyArray())
|
structure(head, emptyArray())
|
||||||
} else if (head < tail) {
|
return
|
||||||
@Suppress("UNCHECKED_CAST")
|
}
|
||||||
structure(head, elementData.sliceArray(head until tail))
|
|
||||||
|
val elements = arrayOfNulls<Any?>(size)
|
||||||
|
if (head < tail) {
|
||||||
|
elementData.copyInto(elements, startIndex = head, endIndex = tail)
|
||||||
|
structure(head, elements)
|
||||||
} else {
|
} else {
|
||||||
@Suppress("UNCHECKED_CAST")
|
elementData.copyInto(elements, startIndex = head)
|
||||||
structure(head - elementData.size, elementData.sliceArray(head until elementData.size).plus(elements = elementData.sliceArray(0 until tail)))
|
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.
|
* 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.iteratorBehavior
|
||||||
import test.collections.behaviors.listIteratorBehavior
|
import test.collections.behaviors.listIteratorBehavior
|
||||||
|
|||||||
Reference in New Issue
Block a user