#include <assert.h>
#include <stdint.h>
-#include "mm/memory.h"
+#include "mm/memory.hpp"
-#include "native/jni.h"
+#include "native/jni.hpp"
#include "native/llni.h"
-#include "native/native.h"
+#include "native/native.hpp"
// FIXME
//#include "native/include/sun_reflect_ConstantPool.h"
#include "native/vm/reflection.hpp"
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
-#include "vm/vm.hpp"
+#include "vm/class.hpp"
#include "vm/exceptions.hpp"
-#include "vm/resolve.h"
+#include "vm/javaobjects.hpp"
+#include "vm/resolve.hpp"
#include "vm/string.hpp"
-
-#include "vmcore/class.h"
-#include "vmcore/javaobjects.hpp"
-#include "vmcore/utf8.h"
+#include "vm/utf8.h"
+#include "vm/vm.hpp"
+// Native functions are exported as C functions.
extern "C" {
/*
}
/* XXX: is that right? or do I have to use resolve_method_*? */
- return (jobject) java_lang_reflect_Method::create(ref->p.method);
+ java_lang_reflect_Method jlrm(ref->p.method);
+
+ return (jobject) jlrm.get_handle();
}
return NULL;
}
- return (jobject) java_lang_reflect_Method::create(ref->p.method);
+ java_lang_reflect_Method jlrm(ref->p.method);
+
+ return (jobject) jlrm.get_handle();
}
constant_FMIref *ref;
classinfo *cls = LLNI_classinfo_unwrap(jcpool);
- ref = (constant_FMIref*)class_getconstant(
- cls, index, CONSTANT_Fieldref);
+ ref = (constant_FMIref*) class_getconstant(cls, index, CONSTANT_Fieldref);
if (ref == NULL) {
exceptions_throw_illegalargumentexception();
return NULL;
}
- return (jobject) java_lang_reflect_Field::create(ref->p.field);
+ // Create a new java.lang.reflect.Field Java object.
+ java_lang_reflect_Field jlrf(ref->p.field);
+
+ return (jobject) jlrf.get_handle();
}
classinfo *c;
classinfo *cls = LLNI_classinfo_unwrap(jcpool);
- ref = (constant_FMIref*)class_getconstant(
- cls, index, CONSTANT_Fieldref);
+ ref = (constant_FMIref*) class_getconstant(cls, index, CONSTANT_Fieldref);
if (ref == NULL) {
exceptions_throw_illegalargumentexception();
return NULL;
}
- return (jobject) java_lang_reflect_Field::create(ref->p.field);
+ // Create a new java.lang.reflect.Field Java object.
+ java_lang_reflect_Field jlrf(ref->p.field);
+
+ return (jobject) jlrf.get_handle();
}
constant_integer *ref;
classinfo *cls = LLNI_classinfo_unwrap(jcpool);
- ref = (constant_integer*)class_getconstant(
- cls, index, CONSTANT_Integer);
+ ref = (constant_integer*) class_getconstant(cls, index, CONSTANT_Integer);
if (ref == NULL) {
exceptions_throw_illegalargumentexception();
*******************************************************************************/
-// FIXME
-extern "C" {
void _Jv_sun_reflect_ConstantPool_init(void)
{
- native_method_register(utf_new_char("sun/reflect/ConstantPool"), methods, NATIVE_METHODS_COUNT);
-}
+ utf* u = utf_new_char("sun/reflect/ConstantPool");
+
+ NativeMethods& nm = VM::get_current()->get_nativemethods();
+ nm.register_methods(u, methods, NATIVE_METHODS_COUNT);
}