#include "native/llni.h"
#include "native/native.h"
-#include "native/include/java_lang_Object.h"
-
-// FIXME
-extern "C" {
-#include "native/include/java_lang_Throwable.h"
-}
+#if defined(ENABLE_JNI_HEADERS)
+# include "native/include/java_lang_Throwable.h"
+#endif
#include "vm/exceptions.hpp"
-#include "vm/jit/stacktrace.hpp"
-
-
-/* native methods implemented by this file ************************************/
-
-static JNINativeMethod methods[] = {
- { (char*) "printStackTrace", (char*) "()V", (void*) (uintptr_t) &Java_java_lang_Throwable_printStackTrace },
- { (char*) "fillInStackTrace", (char*) "()V", (void*) (uintptr_t) &Java_java_lang_Throwable_fillInStackTrace },
-};
+#include "vm/jit/stacktrace.hpp"
-/* _Jv_java_lang_Throwable_init ************************************************
-
- Register native functions.
-
-*******************************************************************************/
-
-// FIXME
-extern "C" {
-void _Jv_java_lang_Throwable_init(void)
-{
- utf *u;
-
- u = utf_new_char("java/lang/Throwable");
-
- native_method_register(u, methods, NATIVE_METHODS_COUNT);
-}
-}
+#include "vmcore/javaobjects.hpp"
// Native functions are exported as C functions.
* Method: printStackTrace
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_java_lang_Throwable_printStackTrace(JNIEnv *env, java_lang_Throwable *_this)
+JNIEXPORT void JNICALL Java_java_lang_Throwable_printStackTrace(JNIEnv *env, jobject _this)
{
- java_handle_t *o;
-
- o = (java_handle_t *) _this;
+ java_lang_Throwable jlt(_this);
- exceptions_print_exception(o);
- stacktrace_print_exception(o);
+ exceptions_print_exception(jlt.get_handle());
+ stacktrace_print_exception(jlt.get_handle());
}
* Method: fillInStackTrace
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_java_lang_Throwable_fillInStackTrace(JNIEnv *env, java_lang_Throwable *_this)
+JNIEXPORT void JNICALL Java_java_lang_Throwable_fillInStackTrace(JNIEnv *env, jobject _this)
{
- java_handle_bytearray_t *ba;
-
- ba = stacktrace_get_current();
+ java_handle_bytearray_t* ba = stacktrace_get_current();
if (ba == NULL)
return;
- LLNI_field_set_ref(_this, backtrace, (java_lang_Object *) ba);
+ java_lang_Throwable jlt(_this);
+ jlt.set_backtrace(ba);
}
} // extern "C"
+/* native methods implemented by this file ************************************/
+
+static JNINativeMethod methods[] = {
+ { (char*) "printStackTrace", (char*) "()V", (void*) (uintptr_t) &Java_java_lang_Throwable_printStackTrace },
+ { (char*) "fillInStackTrace", (char*) "()V", (void*) (uintptr_t) &Java_java_lang_Throwable_fillInStackTrace },
+};
+
+
+/* _Jv_java_lang_Throwable_init ************************************************
+
+ Register native functions.
+
+*******************************************************************************/
+
+// FIXME
+extern "C" {
+void _Jv_java_lang_Throwable_init(void)
+{
+ utf *u;
+
+ u = utf_new_char("java/lang/Throwable");
+
+ native_method_register(u, methods, NATIVE_METHODS_COUNT);
+}
+}
+
+
/*
* These are local overrides for various environment variables in Emacs.
* Please do not remove this and leave it at the end of the file, where