Signed-off-by: Vegard Nossum <vegard.nos...@gmail.com> --- vm/jato.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/vm/jato.c b/vm/jato.c index 7a0f631..229c411 100644 --- a/vm/jato.c +++ b/vm/jato.c @@ -309,6 +309,22 @@ native_vmclass_getname(struct vm_object *object) return vm_object_alloc_string_from_c(class->name); } +static int32_t __vm_native +native_vmclass_isprimitive(struct vm_object *object) +{ + if (!object) { + signal_new_exception(vm_java_lang_NullPointerException, NULL); + throw_from_native(sizeof object); + return 0; + } + + struct vm_class *class = vm_class_get_class_from_class_object(object); + assert(class != NULL); + + /* Note: This function returns a boolean value (despite the int32_t) */ + return class->kind == VM_CLASS_KIND_PRIMITIVE; +} + static struct vm_object * __vm_native native_vmclassloader_getprimitiveclass(int type) { @@ -354,6 +370,7 @@ static struct vm_native natives[] = { DEFINE_NATIVE("jato/internal/VM", "exit", &native_vmruntime_exit), DEFINE_NATIVE("jato/internal/VM", "println", &native_vmruntime_println), DEFINE_NATIVE("java/lang/VMClass", "getName", &native_vmclass_getname), + DEFINE_NATIVE("java/lang/VMClass", "isPrimitive", &native_vmclass_isprimitive), DEFINE_NATIVE("java/lang/VMClassLoader", "getPrimitiveClass", &native_vmclassloader_getprimitiveclass), DEFINE_NATIVE("java/io/VMFile", "isDirectory", &native_vmfile_is_directory), DEFINE_NATIVE("java/lang/VMObject", "clone", &native_vmobject_clone), -- 1.6.0.4 ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel