Debugger: Fix toTypedArray() evaluation (KT-8579)
This commit is contained in:
@@ -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() }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user