Eval4j: add invokePolicy flag to jdiEval

This commit is contained in:
Natalia Ukhorskaya
2014-05-20 18:25:00 +04:00
parent 9c04c9ea38
commit 51b95181f0
2 changed files with 6 additions and 5 deletions
@@ -28,7 +28,8 @@ val BOOTSTRAP_CLASS_DESCRIPTORS = setOf("Ljava/lang/String;", "Ljava/lang/ClassL
class JDIEval(
private val vm: jdi.VirtualMachine,
private val classLoader: jdi.ClassLoaderReference,
private val thread: jdi.ThreadReference
private val thread: jdi.ThreadReference,
private val invokePolicy: Int
) : Eval {
private val primitiveTypes = mapOf(
@@ -192,7 +193,7 @@ class JDIEval(
if (_class !is jdi.ClassType) throwEvalException(NoSuchMethodError("Static method is a non-class type: $method"))
val args = mapArguments(arguments, method.safeArgumentTypes())
val result = mayThrow { _class.invokeMethod(thread, method, args, 0) }
val result = mayThrow { _class.invokeMethod(thread, method, args, invokePolicy) }
return result.asValue()
}
@@ -218,7 +219,7 @@ class JDIEval(
val ctor = findMethod(methodDesc)
val _class = (instance as NewObjectValue).asmType.asReferenceType() as jdi.ClassType
val args = mapArguments(arguments, ctor.safeArgumentTypes())
val result = mayThrow { _class.newInstance(thread, ctor, args, 0) }
val result = mayThrow { _class.newInstance(thread, ctor, args, invokePolicy) }
instance.value = result
return result.asValue()
}
@@ -231,7 +232,7 @@ class JDIEval(
val obj = instance.jdiObj.checkNull()
val method = findMethod(methodDesc, instance.jdiObj!!.referenceType() ?: methodDesc.ownerType.asReferenceType())
val args = mapArguments(arguments, method.safeArgumentTypes())
val result = mayThrow { obj.invokeMethod(thread, method, args, 0) }
val result = mayThrow { obj.invokeMethod(thread, method, args, invokePolicy) }
return result.asValue()
}
@@ -102,7 +102,7 @@ fun suite(): TestSuite {
override fun runTest() {
val eval = JDIEval(
vm, classLoader!!, thread!!
vm, classLoader!!, thread!!, 0
)
val value = interpreterLoop(
methodNode,