From adf6e98cdfca7450670fff1a237790de44daf900 Mon Sep 17 00:00:00 2001 From: Thomas Pani Date: Wed, 7 Sep 2022 00:29:12 +0200 Subject: [PATCH] Handle `_out(STRING)` parameters in Java API (#6325) --- scripts/update_api.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/update_api.py b/scripts/update_api.py index 37b8a31af..41a9face5 100755 --- a/scripts/update_api.py +++ b/scripts/update_api.py @@ -776,6 +776,13 @@ def mk_java(java_src, java_dir, package_name): java_wrapper.write(' jfieldID fid = jenv->GetFieldID(mc, "value", "I");\n') java_wrapper.write(' jenv->SetIntField(a%s, fid, (jint) _a%s);\n' % (i, i)) java_wrapper.write(' }\n') + elif param_type(param) == STRING: + java_wrapper.write(' {\n') + java_wrapper.write(' jclass mc = jenv->GetObjectClass(a%s);\n' % i) + java_wrapper.write(' jfieldID fid = jenv->GetFieldID(mc, "value", "Ljava/lang/String;");') + java_wrapper.write(' jstring fval = jenv->NewStringUTF(_a%s);\n' % i) + java_wrapper.write(' jenv->SetObjectField(a%s, fid, fval);\n' % i) + java_wrapper.write(' }\n') else: java_wrapper.write(' {\n') java_wrapper.write(' jclass mc = jenv->GetObjectClass(a%s);\n' % i)