Refactor java.lang.reflect implementation
Cherry-picked from commit ed41d5c44299ec5d44b8514f6e17f802f48094d1.
Move to ArtMethod/Field instead of AbstractMethod/Field and have
java.lang.reflect APIs delegate to ArtMethod/ArtField.
Bug: 10014286.
Change-Id: Iafc1d8c5b62562c9af8fb9fd8c5e1d61270536e7
diff --git a/runtime/native/java_lang_reflect_Constructor.cc b/runtime/native/java_lang_reflect_Constructor.cc
index 9180217..85556ac 100644
--- a/runtime/native/java_lang_reflect_Constructor.cc
+++ b/runtime/native/java_lang_reflect_Constructor.cc
@@ -16,13 +16,14 @@
#include "class_linker.h"
#include "jni_internal.h"
+#include "mirror/art_method.h"
+#include "mirror/art_method-inl.h"
#include "mirror/class-inl.h"
-#include "mirror/abstract_method.h"
-#include "mirror/abstract_method-inl.h"
#include "mirror/object-inl.h"
#include "object_utils.h"
#include "reflection.h"
#include "scoped_thread_state_change.h"
+#include "well_known_classes.h"
namespace art {
@@ -35,7 +36,10 @@
*/
static jobject Constructor_newInstance(JNIEnv* env, jobject javaMethod, jobjectArray javaArgs) {
ScopedObjectAccess soa(env);
- mirror::AbstractMethod* m = soa.Decode<mirror::Object*>(javaMethod)->AsMethod();
+ jobject art_method = soa.Env()->GetObjectField(
+ javaMethod, WellKnownClasses::java_lang_reflect_AbstractMethod_artMethod);
+
+ mirror::ArtMethod* m = soa.Decode<mirror::Object*>(art_method)->AsArtMethod();
mirror::Class* c = m->GetDeclaringClass();
if (UNLIKELY(c->IsAbstract())) {
ThrowLocation throw_location = soa.Self()->GetCurrentLocationForThrow();