Merged with michi branch at rev 1684fe51cf3d.
[cacao.git] / src / native / vm / cldc1.1 / java_lang_Object.cpp
index 14711dcd784bfb8f3e7c359b19389730b661eb7a..ac38a3751ed2a2cf2f4a2b5c34f97c354fb8f352 100644 (file)
 
 #include "native/jni.hpp"
 #include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
 
 #if defined(ENABLE_JNI_HEADERS)
 # include "native/include/java_lang_Object.h"
 #endif
 
-#include "threads/lock-common.h"
+#include "threads/lock.hpp"
 
 #include "vm/exceptions.hpp"
 #include "vm/javaobjects.hpp"
@@ -52,16 +52,14 @@ extern "C" {
  */
 JNIEXPORT jclass JNICALL Java_java_lang_Object_getClass(JNIEnv *env, jobject obj)
 {
-       classinfo *c;
-
        if (obj == NULL) {
                exceptions_throw_nullpointerexception();
                return NULL;
        }
 
-       LLNI_class_get(obj, c);
+       java_lang_Object o(obj);
 
-       return (jclass) LLNI_classinfo_wrap(c);
+       return (jclass) LLNI_classinfo_wrap(o.get_Class());
 }
 
 
@@ -147,16 +145,12 @@ static JNINativeMethod methods[] = {
  
 *******************************************************************************/
  
-// FIXME
-extern "C" {
 void _Jv_java_lang_Object_init(void)
 {
-       utf *u;
+       utf* u = utf_new_char("java/lang/Object");
  
-       u = utf_new_char("java/lang/Object");
-       native_method_register(u, methods, NATIVE_METHODS_COUNT);
-}
+       NativeMethods& nm = VM::get_current()->get_nativemethods();
+       nm.register_methods(u, methods, NATIVE_METHODS_COUNT);
 }