diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-09-30 00:54:20 -0700 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-09-30 00:55:09 -0700 |
commit | 0eba162ab578cbd96dbdcc20d2fcfab80d2d13d4 (patch) | |
tree | 1838b17ce00dfb95e30ce3ac83ff8fa8c2fa8ed5 /unix/modjni.c | |
parent | f3ca8623f7ee9e7c3fda11ddad3019d4910e9d4e (diff) | |
download | micropython-0eba162ab578cbd96dbdcc20d2fcfab80d2d13d4.tar.gz micropython-0eba162ab578cbd96dbdcc20d2fcfab80d2d13d4.zip |
unix/modjni: Fix method argument matching.
Diffstat (limited to 'unix/modjni.c')
-rw-r--r-- | unix/modjni.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/unix/modjni.c b/unix/modjni.c index 520677b623..04102938a7 100644 --- a/unix/modjni.c +++ b/unix/modjni.c @@ -28,6 +28,7 @@ #include <string.h> #include <errno.h> #include <dlfcn.h> +#include <ctype.h> #include "py/nlr.h" #include "py/runtime0.h" @@ -298,6 +299,9 @@ STATIC bool py2jvalue(const char **jtypesig, mp_obj_t arg, jvalue *out) { } } else if (type == &jobject_type) { printf("TODO: Check java arg type!!\n"); + while (isalpha(*arg_type) || *arg_type == '.') { + arg_type++; + } mp_obj_jobject_t *jo = arg; out->l = jo->obj; } else { @@ -359,7 +363,7 @@ STATIC mp_obj_t call_method(jobject obj, const char *name, jarray methods, bool // printf("name=%p meth_name=%s\n", name, meth_name); bool found = true; - for (int i = 0; i < n_args; i++) { + for (int i = 0; i < n_args && *arg_types != ')'; i++) { if (!py2jvalue(&arg_types, args[i], &jargs[i])) { goto next_method; } @@ -369,6 +373,10 @@ STATIC mp_obj_t call_method(jobject obj, const char *name, jarray methods, bool } } + if (*arg_types != ')') { + goto next_method; + } + if (found) { // printf("found!\n"); jmethodID method_id = JJ(FromReflectedMethod, meth); |