提交 12f2c04a 编写于 作者: A Alexey Sedunov

Misc: Fix argument copying

上级 f42a15bc
......@@ -50,7 +50,10 @@ private fun Any.copyValueIfNeeded(): Any {
is DoubleArray -> Arrays.copyOf(this, size)
is BooleanArray -> Arrays.copyOf(this, size)
is Array<*> -> Array(size) { this[it]?.copyValueIfNeeded() }
is Array<*> -> java.lang.reflect.Array.newInstance(javaClass.componentType, size).apply {
this as Array<Any?>
(this@copyValueIfNeeded as Array<Any?>).forEachIndexed { i, value -> this[i] = value?.copyValueIfNeeded() }
}
is MutableCollection<*> -> (this as Collection<Any?>).mapTo(javaClass.newInstance() as MutableCollection<Any?>) { it?.copyValueIfNeeded() }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册