From b230a86d332376d15b61636111ce47c90a5ab54a Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Tue, 15 Sep 2015 14:07:12 +0300 Subject: [PATCH] unix/modjni: Return any object type value as a jobject. --- unix/modjni.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/unix/modjni.c b/unix/modjni.c index 542dfb8993..ddf7fb0fff 100644 --- a/unix/modjni.c +++ b/unix/modjni.c @@ -237,14 +237,22 @@ ret_string:; ret = mp_obj_new_str(s, strlen(s), false); JJ(ReleaseStringUTFChars, arg, s); return ret; - } else if (MATCH(jtypesig, "java.lang.Object")) { - if (JJ(IsInstanceOf, arg, String_class)) { - goto ret_string; - } else { - return new_jobject(arg); + } else { + while (*jtypesig != ' ' && *jtypesig) { + if (*jtypesig == '.') { + // Non-primitive, object type + if (JJ(IsInstanceOf, arg, String_class)) { + goto ret_string; + } else { + return new_jobject(arg); + } + } + jtypesig++; } } + printf("Unknown return type: %s\n", jtypesig); + return MP_OBJ_NULL; }