[Java] Map `LDKReadOnly*` the same as `LDKLocked*` ie via `AutoClosable`
authorMatt Corallo <git@bluematt.me>
Wed, 29 Jun 2022 15:41:06 +0000 (15:41 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 29 Jun 2022 15:53:54 +0000 (15:53 +0000)
java_strings.py
typescript_strings.py

index 9513db8ec8c9898c841206aca374a1ed8cabe4a4..c4b84146d7805ad7de314143600432fb398e6e8b 100644 (file)
@@ -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")
index 092a9e152631388dbd97c99f8d3ea064db7f989e..9e4cf192a1aa76abf604c1b3123d7265b9840e0c 100644 (file)
@@ -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"""