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/reflection.h b/src/reflection.h
index f5173d9..aabf513 100644
--- a/src/reflection.h
+++ b/src/reflection.h
@@ -23,12 +23,15 @@
namespace art {
class Class;
+class Field;
union JValue;
class Object;
void InitBoxingMethods();
void BoxPrimitive(Primitive::Type src_class, JValue& value);
-bool UnboxPrimitive(Object* o, Class* dst_class, JValue& unboxed_value, const char* what);
+bool UnboxPrimitiveForArgument(Object* o, Class* dst_class, JValue& unboxed_value, size_t index);
+bool UnboxPrimitiveForField(Object* o, Class* dst_class, JValue& unboxed_value, Field* f);
+bool UnboxPrimitiveForResult(Object* o, Class* dst_class, JValue& unboxed_value);
bool ConvertPrimitiveValue(Primitive::Type src_class, Primitive::Type dst_class, const JValue& src, JValue& dst);