Support constructor calls

This commit is contained in:
Andrey Breslav
2013-10-13 12:33:42 +04:00
parent a5dba2938d
commit 205fe325d9
+14
View File
@@ -138,6 +138,20 @@ class JDIEval(
}
override fun invokeMethod(instance: Value, methodDesc: MethodDescription, arguments: List<Value>, invokespecial: Boolean): Value {
if (invokespecial) {
if (methodDesc.name == "<init>") {
// Constructor call
val ctor = findMethod(methodDesc)
val _class = (instance as NewObjectValue).asmType.asReferenceType() as jdi.ClassType
val result = _class.newInstance(thread, ctor, arguments.map { v -> v.asJdiValue(vm) }, 0)
instance.value = result
return result.asValue()
}
else {
// TODO
throw UnsupportedOperationException("invokespecial is not suported yet")
}
}
val method = findMethod(methodDesc)
val obj = instance.jdiObj.checkNull()