Skip to content

Commit b230a86

Browse files
committed
unix/modjni: Return any object type value as a jobject.
1 parent 5167332 commit b230a86

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

unix/modjni.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,14 +237,22 @@ ret_string:;
237237
ret = mp_obj_new_str(s, strlen(s), false);
238238
JJ(ReleaseStringUTFChars, arg, s);
239239
return ret;
240-
} else if (MATCH(jtypesig, "java.lang.Object")) {
241-
if (JJ(IsInstanceOf, arg, String_class)) {
242-
goto ret_string;
243-
} else {
244-
return new_jobject(arg);
240+
} else {
241+
while (*jtypesig != ' ' && *jtypesig) {
242+
if (*jtypesig == '.') {
243+
// Non-primitive, object type
244+
if (JJ(IsInstanceOf, arg, String_class)) {
245+
goto ret_string;
246+
} else {
247+
return new_jobject(arg);
248+
}
249+
}
250+
jtypesig++;
245251
}
246252
}
247253

254+
printf("Unknown return type: %s\n", jtypesig);
255+
248256
return MP_OBJ_NULL;
249257
}
250258

0 commit comments

Comments
 (0)