Improve reflection IllegalArgumentException detail messages.
Also add a missing InstanceOf check that was causing CheckJNI to kill us
if someone tried to pass an inappropriate reference type through
Method.invoke. (Amusingly, CheckJNI produced pretty much the exact detail
message that Method.invoke should have.)
Plus a new test for this stuff.
Bug: 6504175
Change-Id: Ice95eecbdba5a0927c6eaf68e56d6500dc52ad2e
diff --git a/src/oat/runtime/support_proxy.cc b/src/oat/runtime/support_proxy.cc
index 46f2313..cc375ad 100644
--- a/src/oat/runtime/support_proxy.cc
+++ b/src/oat/runtime/support_proxy.cc
@@ -168,7 +168,7 @@
Object* result_ref = self->DecodeJObject(result);
if (result_ref != NULL) {
JValue result_unboxed;
- bool unboxed_okay = UnboxPrimitive(result_ref, proxy_mh.GetReturnType(), result_unboxed, "result");
+ bool unboxed_okay = UnboxPrimitiveForResult(result_ref, proxy_mh.GetReturnType(), result_unboxed);
if (!unboxed_okay) {
self->ClearException();
self->ThrowNewExceptionF("Ljava/lang/ClassCastException;",