Open
Description
Because of this condition instructions like 0=1 are possible. It is wrong behavior. Possible fix:
add additional condition:
if ((oldVar.typeName == expr.typeName && oldVar !is JcRawConstant) || (expr is JcRawNullConstant && !oldVar.typeName.isPrimitive)) {
Failing test:
class InvokeMethodWithException {
class A {
fun lol(a: Int): Int {
return 888/a
}
}
fun box():String {
val method = A::class.java.getMethod("lol", Int::class.java)
var failed = false
try {
method.invoke(null, 0)
}
catch(e: Exception) {
failed = true
}
return if (!failed) "fail" else "OK"
}
}