Skip to content

Commit 9ebd4da

Browse files
committed
unix/modjni: Don't pass Java object to a method which doesn't expect it.
For example, don't pass Integer to double method. This is still not selective enough to choose the right overloaded method maong those taking objects.
1 parent 9273cca commit 9ebd4da

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

unix/modjni.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,19 @@ STATIC bool py2jvalue(const char **jtypesig, mp_obj_t arg, jvalue *out) {
362362
}
363363
} else if (type == &jobject_type) {
364364
printf("TODO: Check java arg type!!\n");
365-
while (isalpha(*arg_type) || *arg_type == '.') {
365+
bool is_object = false;
366+
while (1) {
367+
if (isalpha(*arg_type)) {
368+
} else if (*arg_type == '.') {
369+
is_object = true;
370+
} else {
371+
break;
372+
}
366373
arg_type++;
367374
}
375+
if (!is_object) {
376+
return false;
377+
}
368378
mp_obj_jobject_t *jo = arg;
369379
out->l = jo->obj;
370380
} else if (type == &mp_type_bool) {

0 commit comments

Comments
 (0)