Improve debug-ability of native method registration
If we fail to register a native we construct a stack trace which needs
Throwable and stack trace support. Registering Throwable's natives first
and making Throwable a root supports this. Previously we could only
generate a stack trace when thread start up was complete.
Change-Id: Icc7c1657988c7f36aceb1d4f3e61e7218f55e055
diff --git a/src/object.cc b/src/object.cc
index f90031a..9e3e9d3 100644
--- a/src/object.cc
+++ b/src/object.cc
@@ -1382,6 +1382,20 @@
return result;
}
+
+Class* Throwable::java_lang_Throwable_ = NULL;
+
+void Throwable::SetClass(Class* java_lang_Throwable) {
+ CHECK(java_lang_Throwable_ == NULL);
+ CHECK(java_lang_Throwable != NULL);
+ java_lang_Throwable_ = java_lang_Throwable;
+}
+
+void Throwable::ResetClass() {
+ CHECK(java_lang_Throwable_ != NULL);
+ java_lang_Throwable_ = NULL;
+}
+
Class* StackTraceElement::java_lang_StackTraceElement_ = NULL;
void StackTraceElement::SetClass(Class* java_lang_StackTraceElement) {