From d18825a6f55fc94cf7a55f30a7d87ad8304f6e8d Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 27 Oct 2022 05:26:55 +0000 Subject: [PATCH] [Java] Fix calling trait methods which return simple enums from C --- java_strings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java_strings.py b/java_strings.py index 487df5d6..b2a9d853 100644 --- a/java_strings.py +++ b/java_strings.py @@ -1013,8 +1013,8 @@ import javax.annotation.Nullable; if fn_line.ret_ty_info.c_ty.endswith("Array"): out_c = out_c + "\t" + fn_line.ret_ty_info.c_ty + " ret = (*env)->CallObjectMethod(env, obj, j_calls->" + fn_line.fn_name + "_meth" elif fn_line.ret_ty_info.c_ty == "void": - out_c += "\t(*env)->Call" + fn_line.ret_ty_info.java_ty.title() + "Method(env, obj, j_calls->" + fn_line.fn_name + "_meth" - elif fn_line.ret_ty_info.java_hu_ty == "String": + out_c += "\t(*env)->CallVoidMethod(env, obj, j_calls->" + fn_line.fn_name + "_meth" + elif fn_line.ret_ty_info.java_hu_ty == "String" or "org/ldk/enums" in fn_line.ret_ty_info.java_fn_ty_arg: # Manually write out String methods as they're just an Object out_c += "\t" + fn_line.ret_ty_info.c_ty + " ret = (*env)->CallObjectMethod(env, obj, j_calls->" + fn_line.fn_name + "_meth" elif not fn_line.ret_ty_info.passed_as_ptr: -- 2.39.5