update tests for new upstream and check null result
[ldk-java] / java_strings.py
index d4931cd912038295c89ab63ce11f0ffdbe9e35e7..f4c80d3eb526573204f873ae7ee2a1d68f88f75a 100644 (file)
@@ -1137,6 +1137,8 @@ import java.util.Arrays;
             meth_n = method_name[len(struct_meth) + 1 if len(struct_meth) != 0 else 0:].strip("_")
             if doc_comment is not None:
                 out_java_struct += "\t/**\n\t * " + doc_comment.replace("\n", "\n\t * ") + "\n\t */\n"
+            if return_type_info.nullable:
+                out_java_struct += "\t@Nullable\n"
             if not takes_self:
                 if meth_n == "new":
                     out_java_struct += "\tpublic static " + return_type_info.java_hu_ty + " of("
@@ -1154,12 +1156,15 @@ import java.util.Arrays;
                     continue
                 if arg.java_ty != "void":
                     if arg.arg_name in default_constructor_args:
+                        assert not arg.nullable
                         for explode_idx, explode_arg in enumerate(default_constructor_args[arg.arg_name]):
                             if explode_idx != 0:
                                 out_java_struct += (", ")
                             out_java_struct += (
                                 explode_arg.java_hu_ty + " " + arg.arg_name + "_" + explode_arg.arg_name)
                     else:
+                        if arg.nullable:
+                            out_java_struct += "@Nullable "
                         out_java_struct += (arg.java_hu_ty + " " + arg.arg_name)
         out_java += (");\n")
         out_c += (") {\n")