ART: Add Class.getEnclosingClass() to UnstartedRuntime
Required to initialize classes calling getSimpleName().
Bug: 27265238
(cherry picked from commit fb5c22e28030cc9ba8424b7f6f70677ec3ba3afc)
Change-Id: Id63dac5b75b3bbcdfe80f73f2d9d76dea3996823
diff --git a/runtime/interpreter/unstarted_runtime.cc b/runtime/interpreter/unstarted_runtime.cc
index 60ad0cb..0e175b8 100644
--- a/runtime/interpreter/unstarted_runtime.cc
+++ b/runtime/interpreter/unstarted_runtime.cc
@@ -261,6 +261,16 @@
}
}
+void UnstartedRuntime::UnstartedClassGetEnclosingClass(
+ Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) {
+ StackHandleScope<1> hs(self);
+ Handle<mirror::Class> klass(hs.NewHandle(shadow_frame->GetVRegReference(arg_offset)->AsClass()));
+ if (klass->IsProxyClass() || klass->GetDexCache() == nullptr) {
+ result->SetL(nullptr);
+ }
+ result->SetL(klass->GetDexFile().GetEnclosingClass(klass));
+}
+
void UnstartedRuntime::UnstartedVmClassLoaderFindLoadedClass(
Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) {
mirror::String* class_name = shadow_frame->GetVRegReference(arg_offset + 1)->AsString();