From 91ed1302865bf484c1ce45945b59726917be1bf0 Mon Sep 17 00:00:00 2001 From: Yan Zhulanow Date: Tue, 19 Sep 2017 23:58:10 +0300 Subject: [PATCH] Add additional diagnostic for EA-107110 --- eval4j/src/org/jetbrains/eval4j/jdi/jdiEval.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/eval4j/src/org/jetbrains/eval4j/jdi/jdiEval.kt b/eval4j/src/org/jetbrains/eval4j/jdi/jdiEval.kt index cfe7e0c07a1..ddd63711516 100644 --- a/eval4j/src/org/jetbrains/eval4j/jdi/jdiEval.kt +++ b/eval4j/src/org/jetbrains/eval4j/jdi/jdiEval.kt @@ -259,7 +259,15 @@ class JDIEval( val field = findField(fieldDesc) val obj = instance.jdiObj.checkNull() - return mayThrow { obj.getValue(field) }.ifFail(field, obj).asValue() + return mayThrow { + try { + obj.getValue(field) + } catch (e: IllegalArgumentException) { + throw IllegalArgumentException("Possibly incompatible types: " + + "field declaring type = ${field.declaringType()}, " + + "instance type = ${obj.referenceType()}") + } + }.ifFail(field, obj).asValue() } override fun setField(instance: Value, fieldDesc: FieldDescription, newValue: Value) {