Signed-off-by: Tomek Grabiec <tgrab...@gmail.com>
---
 include/vm/reflection.h |    1 +
 vm/jato.c               |    1 +
 vm/reflection.c         |   18 ++++++++++++++++++
 3 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/include/vm/reflection.h b/include/vm/reflection.h
index f9c709a..c1e3aa4 100644
--- a/include/vm/reflection.h
+++ b/include/vm/reflection.h
@@ -39,5 +39,6 @@ native_method_invokenative(struct vm_object *method, struct 
vm_object *o,
                           struct vm_object *declaringClass,
                           jint slot);
 void native_field_set(struct vm_object *this, struct vm_object *o, struct 
vm_object *value_obj);
+struct vm_object *native_method_getreturntype(struct vm_object *method);
 
 #endif /* __JATO_VM_REFLECTION_H */
diff --git a/vm/jato.c b/vm/jato.c
index 332b3fb..1c84ccf 100644
--- a/vm/jato.c
+++ b/vm/jato.c
@@ -877,6 +877,7 @@ static struct vm_native natives[] = {
        DEFINE_NATIVE("java/lang/reflect/Field", "getType", 
&native_field_gettype),
        DEFINE_NATIVE("java/lang/reflect/Method", "getParameterTypes", 
&native_method_get_parameter_types),
        DEFINE_NATIVE("java/lang/reflect/Method", "invokeNative", 
&native_method_invokenative),
+       DEFINE_NATIVE("java/lang/reflect/Method", "getReturnType", 
&native_method_getreturntype),
        DEFINE_NATIVE("jato/internal/VM", "enableFault", 
&native_vm_enable_fault),
        DEFINE_NATIVE("jato/internal/VM", "disableFault", 
&native_vm_disable_fault),
        DEFINE_NATIVE("sun/misc/Unsafe", "compareAndSwapInt", 
native_unsafe_compare_and_swap_int),
diff --git a/vm/reflection.c b/vm/reflection.c
index d180634..80db700 100644
--- a/vm/reflection.c
+++ b/vm/reflection.c
@@ -810,3 +810,21 @@ struct vm_object *native_field_gettype(struct vm_object 
*this)
 
        return vmc->object;
 }
+
+struct vm_object *native_method_getreturntype(struct vm_object *method)
+{
+       struct vm_method *vmm = vm_object_to_vm_method(method);
+       if (!vmm)
+               return NULL;
+
+       struct vm_class *vmc;
+
+       vmc = vm_type_to_class(vmm->class->classloader, &vmm->return_type);
+       if (vmc)
+               vm_class_ensure_init(vmc);
+
+       if (!vmc || exception_occurred())
+               return NULL;
+
+       return vmc->object;
+}
-- 
1.6.0.4


------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to