Redo constructor function names to feel more natural in Java
[ldk-java] / java_strings.py
index a616a24a38f8de72c9f1ab0643ba9d06f0a5c899..cc545e8297f97797dc53ce3b91924c12fe6cf7d9 100644 (file)
@@ -1043,8 +1043,12 @@ import java.util.Arrays;
             if doc_comment is not None:
                 out_java_struct += "\t/**\n\t * " + doc_comment.replace("\n", "\n\t * ") + "\n\t */\n"
             if not takes_self:
-                out_java_struct += (
-                    "\tpublic static " + return_type_info.java_hu_ty + " constructor_" + meth_n + "(")
+                if meth_n == "new":
+                    out_java_struct += "\tpublic static " + return_type_info.java_hu_ty + " of("
+                elif meth_n == "default":
+                    out_java_struct += "\tpublic static " + return_type_info.java_hu_ty + " with_default("
+                else:
+                    out_java_struct += "\tpublic static " + return_type_info.java_hu_ty + " " + meth_n + "("
             else:
                 out_java_struct += ("\tpublic " + return_type_info.java_hu_ty + " " + meth_n + "(")
             for idx, arg in enumerate(argument_types):