- if fn_line.ret_ty_info.java_ty != "void":
- java_trait_constr = java_trait_constr + "\t\t\t\t" + fn_line.ret_ty_info.java_hu_ty + " ret = arg." + fn_line.fn_name + "("
- else:
- java_trait_constr = java_trait_constr + "\t\t\t\targ." + fn_line.fn_name + "("
-
- for idx, arg_info in enumerate(fn_line.args_ty):
- if idx != 0:
- java_trait_constr = java_trait_constr + ", "
- if arg_info.to_hu_conv_name is not None:
- java_trait_constr = java_trait_constr + arg_info.to_hu_conv_name
- else:
- java_trait_constr = java_trait_constr + arg_info.arg_name
-
- java_trait_constr = java_trait_constr + ");\n"
- if fn_line.ret_ty_info.java_ty != "void":
- if fn_line.ret_ty_info.from_hu_conv is not None:
- java_trait_constr = java_trait_constr + "\t\t\t\t" + fn_line.ret_ty_info.java_ty + " result = " + fn_line.ret_ty_info.from_hu_conv[0] + ";\n"
- if fn_line.ret_ty_info.from_hu_conv[1] != "":
- java_trait_constr = java_trait_constr + "\t\t\t\t" + fn_line.ret_ty_info.from_hu_conv[1].replace("this", "impl_holder.held") + ";\n"
- #if fn_line.ret_ty_info.rust_obj in result_types:
- # XXX: We need to handle this in conversion logic so that its cross-language!
- # Avoid double-free by breaking the result - we should learn to clone these and then we can be safe instead
- # java_trait_constr = java_trait_constr + "\t\t\t\tret.ptr = 0;\n"
- java_trait_constr = java_trait_constr + "\t\t\t\treturn result;\n"
- else:
- java_trait_constr = java_trait_constr + "\t\t\t\treturn ret;\n"
- java_trait_constr = java_trait_constr + "\t\t\t}\n"
- java_trait_constr = java_trait_constr + "\t\t}"
- for var in field_var_conversions:
- if isinstance(var, ConvInfo):
- java_trait_constr = java_trait_constr + ", " + var.arg_name
- else:
- java_trait_constr = java_trait_constr + ", " + var[1] + ".new_impl(" + var[1] + "_impl).bindings_instance"
- out_java_trait += java_trait_constr + ");\n\t\treturn impl_holder.held;\n\t}\n"