Rename
This commit is contained in:
@@ -176,7 +176,7 @@ class SingleInstructionInterpreter(private val eval: Eval) : Interpreter<Value>(
|
|||||||
ObjectValue(value.obj, targetType)
|
ObjectValue(value.obj, targetType)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throwException(ClassCastException("Value '$value' cannot be cast to $targetType"))
|
throwEvalException(ClassCastException("Value '$value' cannot be cast to $targetType"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ class JDIEval(
|
|||||||
val _class = fieldDesc.ownerType.asReferenceType()
|
val _class = fieldDesc.ownerType.asReferenceType()
|
||||||
val field = _class.fieldByName(fieldDesc.name)
|
val field = _class.fieldByName(fieldDesc.name)
|
||||||
if (field == null) {
|
if (field == null) {
|
||||||
throwException(NoSuchFieldError("Field not found: $fieldDesc"))
|
throwEvalException(NoSuchFieldError("Field not found: $fieldDesc"))
|
||||||
}
|
}
|
||||||
return field
|
return field
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,7 @@ class JDIEval(
|
|||||||
private fun findStaticField(fieldDesc: FieldDescription): jdi.Field {
|
private fun findStaticField(fieldDesc: FieldDescription): jdi.Field {
|
||||||
val field = findField(fieldDesc)
|
val field = findField(fieldDesc)
|
||||||
if (!field.isStatic()) {
|
if (!field.isStatic()) {
|
||||||
throwException(NoSuchFieldError("Field is not static: $fieldDesc"))
|
throwEvalException(NoSuchFieldError("Field is not static: $fieldDesc"))
|
||||||
}
|
}
|
||||||
return field
|
return field
|
||||||
}
|
}
|
||||||
@@ -123,12 +123,12 @@ class JDIEval(
|
|||||||
val field = findStaticField(fieldDesc)
|
val field = findStaticField(fieldDesc)
|
||||||
|
|
||||||
if (field.isFinal()) {
|
if (field.isFinal()) {
|
||||||
throwException(NoSuchFieldError("Can't modify a final field: $field"))
|
throwEvalException(NoSuchFieldError("Can't modify a final field: $field"))
|
||||||
}
|
}
|
||||||
|
|
||||||
val _class = field.declaringType()
|
val _class = field.declaringType()
|
||||||
if (_class !is jdi.ClassType) {
|
if (_class !is jdi.ClassType) {
|
||||||
throwException(NoSuchFieldError("Can't a field in a non-class: $field"))
|
throwEvalException(NoSuchFieldError("Can't a field in a non-class: $field"))
|
||||||
}
|
}
|
||||||
|
|
||||||
val jdiValue = newValue.asJdiValue(vm)
|
val jdiValue = newValue.asJdiValue(vm)
|
||||||
@@ -145,7 +145,7 @@ class JDIEval(
|
|||||||
else -> _class.methodsByName(methodDesc.name, methodDesc.desc)
|
else -> _class.methodsByName(methodDesc.name, methodDesc.desc)
|
||||||
}
|
}
|
||||||
if (method.isEmpty()) {
|
if (method.isEmpty()) {
|
||||||
throwException(NoSuchMethodError("Method not found: $methodDesc"))
|
throwEvalException(NoSuchMethodError("Method not found: $methodDesc"))
|
||||||
}
|
}
|
||||||
return method[0]
|
return method[0]
|
||||||
}
|
}
|
||||||
@@ -153,10 +153,10 @@ class JDIEval(
|
|||||||
override fun invokeStaticMethod(methodDesc: MethodDescription, arguments: List<Value>): Value {
|
override fun invokeStaticMethod(methodDesc: MethodDescription, arguments: List<Value>): Value {
|
||||||
val method = findMethod(methodDesc)
|
val method = findMethod(methodDesc)
|
||||||
if (!method.isStatic()) {
|
if (!method.isStatic()) {
|
||||||
throwException(NoSuchMethodError("Method is not static: $methodDesc"))
|
throwEvalException(NoSuchMethodError("Method is not static: $methodDesc"))
|
||||||
}
|
}
|
||||||
val _class = method.declaringType()
|
val _class = method.declaringType()
|
||||||
if (_class !is jdi.ClassType) throwException(NoSuchMethodError("Static method is a non-class type: $method"))
|
if (_class !is jdi.ClassType) throwEvalException(NoSuchMethodError("Static method is a non-class type: $method"))
|
||||||
|
|
||||||
val args = arguments.map { v -> v.asJdiValue(vm) }
|
val args = arguments.map { v -> v.asJdiValue(vm) }
|
||||||
val result = mayThrow { _class.invokeMethod(thread, method, args, 0) }
|
val result = mayThrow { _class.invokeMethod(thread, method, args, 0) }
|
||||||
|
|||||||
@@ -101,11 +101,11 @@ val Value.obj: Any?
|
|||||||
|
|
||||||
fun <T: Any> T?.checkNull(): T {
|
fun <T: Any> T?.checkNull(): T {
|
||||||
if (this == null) {
|
if (this == null) {
|
||||||
throwException(NullPointerException())
|
throwEvalException(NullPointerException())
|
||||||
}
|
}
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun throwException(e: Throwable): Nothing {
|
fun throwEvalException(e: Throwable): Nothing {
|
||||||
throw ThrownFromEvalException(ObjectValue(e, Type.getType(e.javaClass)))
|
throw ThrownFromEvalException(ObjectValue(e, Type.getType(e.javaClass)))
|
||||||
}
|
}
|
||||||
@@ -170,7 +170,7 @@ object REFLECTION_EVAL : Eval {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e: Throwable) {
|
catch (e: Throwable) {
|
||||||
throwException(e)
|
throwEvalException(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user