From: Matt Corallo Date: Wed, 29 Jun 2022 15:41:06 +0000 (+0000) Subject: [Java] Map `LDKReadOnly*` the same as `LDKLocked*` ie via `AutoClosable` X-Git-Tag: v0.0.108.0^2~12 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=b288575d60c4b4e15fc61ac93a127fcd677b8da6;p=ldk-java [Java] Map `LDKReadOnly*` the same as `LDKLocked*` ie via `AutoClosable` --- diff --git a/java_strings.py b/java_strings.py index 9513db8e..c4b84146 100644 --- a/java_strings.py +++ b/java_strings.py @@ -1249,11 +1249,11 @@ import javax.annotation.Nullable; out_opaque_struct_human += "@SuppressWarnings(\"unchecked\") // We correctly assign various generic arrays\n" hu_name = struct_name.replace("LDKC2Tuple", "TwoTuple").replace("LDKC3Tuple", "ThreeTuple").replace("LDK", "") out_opaque_struct_human += ("public class " + hu_name + " extends CommonBase") - if struct_name.startswith("LDKLocked"): + if struct_name.startswith("LDKLocked") or struct_name.startswith("LDKReadOnly"): out_opaque_struct_human += (" implements AutoCloseable") out_opaque_struct_human += (" {\n") out_opaque_struct_human += ("\t" + hu_name + "(Object _dummy, long ptr) { super(ptr); }\n") - if struct_name.startswith("LDKLocked"): + if struct_name.startswith("LDKLocked") or struct_name.startswith("LDKReadOnly"): out_opaque_struct_human += ("\t@Override public void close() {\n") else: out_opaque_struct_human += ("\t@Override @SuppressWarnings(\"deprecation\")\n") diff --git a/typescript_strings.py b/typescript_strings.py index 092a9e15..9e4cf192 100644 --- a/typescript_strings.py +++ b/typescript_strings.py @@ -1199,7 +1199,7 @@ export class {struct_name.replace("LDK","")} extends CommonBase {{ hu_name = struct_name.replace("LDKC2Tuple", "TwoTuple").replace("LDKC3Tuple", "ThreeTuple").replace("LDK", "") out_opaque_struct_human = f"{self.hu_struct_file_prefix}" - if struct_name.startswith("LDKLocked"): + if struct_name.startswith("LDKLocked") or struct_name.startswith("LDKReadOnly"): out_opaque_struct_human += "/** XXX: DO NOT USE THIS - it remains locked until the GC runs (if that ever happens */" formatted_doc_comment = struct_doc_comment.replace("\n", "\n * ") out_opaque_struct_human += f"""