Debugger: Fix toTypedArray() evaluation (KT-8579)

This commit is contained in:
Yan Zhulanow
2019-04-17 23:32:38 +03:00
parent 9ae8a8abf1
commit bb0bc8a38a
4 changed files with 43 additions and 1 deletions
@@ -444,7 +444,7 @@ class JDIEval(
"(L${OBJECT.internalName};[L${OBJECT.internalName};)L${OBJECT.internalName};",
true
),
listOf(instance, *args.map { it.asValue() }.toTypedArray())
listOf(instance, mirrorOfArgs(args))
)
if (methodDesc.returnType.sort != Type.OBJECT && methodDesc.returnType.sort != Type.ARRAY && methodDesc.returnType.sort != Type.VOID) {
@@ -453,6 +453,17 @@ class JDIEval(
return invocationResult
}
private fun mirrorOfArgs(args: List<jdi_Value?>): Value {
val arrayObject = newArray(Type.getType("[" + OBJECT.descriptor), args.size)
args.forEachIndexed { index, value ->
val indexValue = vm.mirrorOf(index).asValue()
setArrayElement(arrayObject, indexValue, value.asValue())
}
return arrayObject
}
private fun List<jdi_Value?>.disableCollection() {
forEach { (it as? ObjectReference)?.disableCollection() }
}