diff options
Diffstat (limited to 'runtime/reflection_test.cc')
| -rw-r--r-- | runtime/reflection_test.cc | 11 | 
1 files changed, 10 insertions, 1 deletions
diff --git a/runtime/reflection_test.cc b/runtime/reflection_test.cc index 3b66abee2a..abe68ef8d7 100644 --- a/runtime/reflection_test.cc +++ b/runtime/reflection_test.cc @@ -109,7 +109,16 @@ class ReflectionTest : public CommonCompilerTest {                          : c->FindVirtualMethod(method_name, method_signature);      CHECK(method != nullptr); -    *receiver = (is_static ? nullptr : c->AllocObject(self)); +    if (is_static) { +      *receiver = nullptr; +    } else { +      // Ensure class is initialized before allocating object +      StackHandleScope<1> hs(self); +      Handle<mirror::Class> h_class(hs.NewHandle(c)); +      bool initialized = class_linker_->EnsureInitialized(h_class, true, true); +      CHECK(initialized); +      *receiver = c->AllocObject(self); +    }      // Start runtime.      bool started = runtime_->Start();  |