]> git.bitcoin.ninja Git - ldk-java/commitdiff
Use AutoCloseable for structs named Locked*
authorMatt Corallo <git@bluematt.me>
Wed, 14 Oct 2020 00:06:11 +0000 (20:06 -0400)
committerMatt Corallo <git@bluematt.me>
Wed, 14 Oct 2020 00:06:11 +0000 (20:06 -0400)
76 files changed:
genbindings.py
src/main/java/org/ldk/structs/AcceptChannel.java
src/main/java/org/ldk/structs/AnnouncementSignatures.java
src/main/java/org/ldk/structs/ChainMonitor.java
src/main/java/org/ldk/structs/ChannelAnnouncement.java
src/main/java/org/ldk/structs/ChannelConfig.java
src/main/java/org/ldk/structs/ChannelDetails.java
src/main/java/org/ldk/structs/ChannelFeatures.java
src/main/java/org/ldk/structs/ChannelHandshakeConfig.java
src/main/java/org/ldk/structs/ChannelHandshakeLimits.java
src/main/java/org/ldk/structs/ChannelInfo.java
src/main/java/org/ldk/structs/ChannelManager.java
src/main/java/org/ldk/structs/ChannelManagerReadArgs.java
src/main/java/org/ldk/structs/ChannelMonitor.java
src/main/java/org/ldk/structs/ChannelMonitorUpdate.java
src/main/java/org/ldk/structs/ChannelPublicKeys.java
src/main/java/org/ldk/structs/ChannelReestablish.java
src/main/java/org/ldk/structs/ChannelUpdate.java
src/main/java/org/ldk/structs/ClosingSigned.java
src/main/java/org/ldk/structs/CommitmentSigned.java
src/main/java/org/ldk/structs/CommitmentUpdate.java
src/main/java/org/ldk/structs/DataLossProtect.java
src/main/java/org/ldk/structs/DecodeError.java
src/main/java/org/ldk/structs/DirectionalChannelInfo.java
src/main/java/org/ldk/structs/ErrorMessage.java
src/main/java/org/ldk/structs/FundingCreated.java
src/main/java/org/ldk/structs/FundingLocked.java
src/main/java/org/ldk/structs/FundingSigned.java
src/main/java/org/ldk/structs/GossipTimestampFilter.java
src/main/java/org/ldk/structs/HTLCOutputInCommitment.java
src/main/java/org/ldk/structs/HTLCUpdate.java
src/main/java/org/ldk/structs/HolderCommitmentTransaction.java
src/main/java/org/ldk/structs/InMemoryChannelKeys.java
src/main/java/org/ldk/structs/Init.java
src/main/java/org/ldk/structs/InitFeatures.java
src/main/java/org/ldk/structs/KeysManager.java
src/main/java/org/ldk/structs/LightningError.java
src/main/java/org/ldk/structs/LockedNetworkGraph.java
src/main/java/org/ldk/structs/MessageHandler.java
src/main/java/org/ldk/structs/MonitorEvent.java
src/main/java/org/ldk/structs/MonitorUpdateError.java
src/main/java/org/ldk/structs/NetGraphMsgHandler.java
src/main/java/org/ldk/structs/NetworkGraph.java
src/main/java/org/ldk/structs/NodeAnnouncement.java
src/main/java/org/ldk/structs/NodeAnnouncementInfo.java
src/main/java/org/ldk/structs/NodeFeatures.java
src/main/java/org/ldk/structs/NodeInfo.java
src/main/java/org/ldk/structs/OpenChannel.java
src/main/java/org/ldk/structs/OutPoint.java
src/main/java/org/ldk/structs/PaymentSendFailure.java
src/main/java/org/ldk/structs/PeerHandleError.java
src/main/java/org/ldk/structs/PeerManager.java
src/main/java/org/ldk/structs/Ping.java
src/main/java/org/ldk/structs/Pong.java
src/main/java/org/ldk/structs/PreCalculatedTxCreationKeys.java
src/main/java/org/ldk/structs/QueryChannelRange.java
src/main/java/org/ldk/structs/QueryShortChannelIds.java
src/main/java/org/ldk/structs/ReplyChannelRange.java
src/main/java/org/ldk/structs/ReplyShortChannelIdsEnd.java
src/main/java/org/ldk/structs/RevokeAndACK.java
src/main/java/org/ldk/structs/Route.java
src/main/java/org/ldk/structs/RouteHint.java
src/main/java/org/ldk/structs/RouteHop.java
src/main/java/org/ldk/structs/RoutingFees.java
src/main/java/org/ldk/structs/Shutdown.java
src/main/java/org/ldk/structs/TxCreationKeys.java
src/main/java/org/ldk/structs/UnsignedChannelAnnouncement.java
src/main/java/org/ldk/structs/UnsignedChannelUpdate.java
src/main/java/org/ldk/structs/UnsignedNodeAnnouncement.java
src/main/java/org/ldk/structs/UpdateAddHTLC.java
src/main/java/org/ldk/structs/UpdateFailHTLC.java
src/main/java/org/ldk/structs/UpdateFailMalformedHTLC.java
src/main/java/org/ldk/structs/UpdateFee.java
src/main/java/org/ldk/structs/UpdateFulfillHTLC.java
src/main/java/org/ldk/structs/UserConfig.java
src/test/java/org/ldk/HumanObjectPeerTest.java

index a0d0ab629c6dfe3dfa9cae8e8aba1ac7517984f8..f4086f56adc1aad997c9d02b8673efe2aba90717 100755 (executable)
@@ -1211,11 +1211,18 @@ class CommonBase {
                         out_java_struct.write("package org.ldk.structs;\n\n")
                         out_java_struct.write("import org.ldk.impl.bindings;\n")
                         out_java_struct.write("import org.ldk.enums.*;\n\n")
-                        out_java_struct.write("public class " + struct_name.replace("LDK","") + " extends CommonBase {\n")
+                        out_java_struct.write("public class " + struct_name.replace("LDK","") + " extends CommonBase")
+                        if struct_name.startswith("LDKLocked"):
+                            out_java_struct.write(" implements AutoCloseable")
+                        out_java_struct.write(" {\n")
                         out_java_struct.write("\t" + struct_name.replace("LDK", "") + "(Object _dummy, long ptr) { super(ptr); }\n")
-                        out_java_struct.write("\t@Override @SuppressWarnings(\"deprecation\")\n")
-                        out_java_struct.write("\tprotected void finalize() throws Throwable {\n")
-                        out_java_struct.write("\t\tbindings." + struct_name.replace("LDK","") + "_free(ptr); super.finalize();\n")
+                        if struct_name.startswith("LDKLocked"):
+                            out_java_struct.write("\t@Override public void close() {\n")
+                        else:
+                            out_java_struct.write("\t@Override @SuppressWarnings(\"deprecation\")\n")
+                            out_java_struct.write("\tprotected void finalize() throws Throwable {\n")
+                            out_java_struct.write("\t\tsuper.finalize();\n")
+                        out_java_struct.write("\t\tbindings." + struct_name.replace("LDK","") + "_free(ptr);\n")
                         out_java_struct.write("\t}\n\n")
                 elif result_contents is not None:
                     result_templ_structs.add(struct_name)
index e7c4b472dd3f104b919cd5ce7a50e4e324228bf8..a3c4f0c323829823401941b435bced5afd8e8422 100644 (file)
@@ -7,7 +7,8 @@ public class AcceptChannel extends CommonBase {
        AcceptChannel(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.AcceptChannel_free(ptr); super.finalize();
+               super.finalize();
+               bindings.AcceptChannel_free(ptr);
        }
 
        public AcceptChannel(AcceptChannel orig) {
index b481274685754d1c0bc1d2c8a685ad24b95c5016..90abb315a7e3ee09aeed38078bc87d2608de780b 100644 (file)
@@ -7,7 +7,8 @@ public class AnnouncementSignatures extends CommonBase {
        AnnouncementSignatures(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.AnnouncementSignatures_free(ptr); super.finalize();
+               super.finalize();
+               bindings.AnnouncementSignatures_free(ptr);
        }
 
        public AnnouncementSignatures(AnnouncementSignatures orig) {
index 55a934a2ee698614e0cfeb301f8be5fc8c13c85c..94e0f36ee503c469528beb311eb344fd59edefc6 100644 (file)
@@ -7,7 +7,8 @@ public class ChainMonitor extends CommonBase {
        ChainMonitor(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.ChainMonitor_free(ptr); super.finalize();
+               super.finalize();
+               bindings.ChainMonitor_free(ptr);
        }
 
        // Skipped ChainMonitor_block_connected
index 69c573d8af3a2675de81fb8408526c8483f7962e..0b17c7a01a983307fa78ca60553bd245e9f7688e 100644 (file)
@@ -7,7 +7,8 @@ public class ChannelAnnouncement extends CommonBase {
        ChannelAnnouncement(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.ChannelAnnouncement_free(ptr); super.finalize();
+               super.finalize();
+               bindings.ChannelAnnouncement_free(ptr);
        }
 
        public ChannelAnnouncement(ChannelAnnouncement orig) {
index 7676cae3051952892f79503781f7c101a6818565..fe80bccf543880aea036355c9e5dfb94676f33f9 100644 (file)
@@ -7,7 +7,8 @@ public class ChannelConfig extends CommonBase {
        ChannelConfig(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.ChannelConfig_free(ptr); super.finalize();
+               super.finalize();
+               bindings.ChannelConfig_free(ptr);
        }
 
        public ChannelConfig(ChannelConfig orig) {
index 35107dd52aed84bd78f6490c1e94115a47747b22..677ec97246c8572e802c6f1ff7983c4899b17bac 100644 (file)
@@ -7,7 +7,8 @@ public class ChannelDetails extends CommonBase {
        ChannelDetails(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.ChannelDetails_free(ptr); super.finalize();
+               super.finalize();
+               bindings.ChannelDetails_free(ptr);
        }
 
        public ChannelDetails(ChannelDetails orig) {
index e697e791792173b2ef25fcd9712c3256b2e5495a..2a21c80d3caf822cbd6de909dbc1a0cae1684bd7 100644 (file)
@@ -7,7 +7,8 @@ public class ChannelFeatures extends CommonBase {
        ChannelFeatures(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.ChannelFeatures_free(ptr); super.finalize();
+               super.finalize();
+               bindings.ChannelFeatures_free(ptr);
        }
 
 }
index f8cea8fd91409ef0c43133ebf3ddbabba61ca154..a543225aae77eaab633c7aa3badf45581c666763 100644 (file)
@@ -7,7 +7,8 @@ public class ChannelHandshakeConfig extends CommonBase {
        ChannelHandshakeConfig(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.ChannelHandshakeConfig_free(ptr); super.finalize();
+               super.finalize();
+               bindings.ChannelHandshakeConfig_free(ptr);
        }
 
        public ChannelHandshakeConfig(ChannelHandshakeConfig orig) {
index 309e07b14cef6c2a74073f429dcf09a6796da268..1df3f8cbb8e73f8094228e1c99215768770b817a 100644 (file)
@@ -7,7 +7,8 @@ public class ChannelHandshakeLimits extends CommonBase {
        ChannelHandshakeLimits(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.ChannelHandshakeLimits_free(ptr); super.finalize();
+               super.finalize();
+               bindings.ChannelHandshakeLimits_free(ptr);
        }
 
        public ChannelHandshakeLimits(ChannelHandshakeLimits orig) {
index b0de8cbede3f1c43d5372b065f58777e294dde28..d5b23cc4d0e8d63283b1e0dd14860ba9e1bd85a0 100644 (file)
@@ -7,7 +7,8 @@ public class ChannelInfo extends CommonBase {
        ChannelInfo(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.ChannelInfo_free(ptr); super.finalize();
+               super.finalize();
+               bindings.ChannelInfo_free(ptr);
        }
 
        public ChannelFeatures get_features(ChannelInfo this_ptr) {
index dbf4fedaeccf18e9bb53ea97a5e8dce395b55234..ec82ff9e609b74b598f1b5d58451a8a9ca0084c2 100644 (file)
@@ -7,7 +7,8 @@ public class ChannelManager extends CommonBase {
        ChannelManager(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.ChannelManager_free(ptr); super.finalize();
+               super.finalize();
+               bindings.ChannelManager_free(ptr);
        }
 
        public ChannelManager(LDKNetwork network, FeeEstimator fee_est, Watch chain_monitor, BroadcasterInterface tx_broadcaster, Logger logger, KeysInterface keys_manager, UserConfig config, long current_blockchain_height) {
index de7bf4a66be55b6667daebeff0477337734afe00..a7a90e6fe8e0c97ffd8c992ba0f0a7ad3c22c6e4 100644 (file)
@@ -7,7 +7,8 @@ public class ChannelManagerReadArgs extends CommonBase {
        ChannelManagerReadArgs(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.ChannelManagerReadArgs_free(ptr); super.finalize();
+               super.finalize();
+               bindings.ChannelManagerReadArgs_free(ptr);
        }
 
        public KeysInterface get_keys_manager(ChannelManagerReadArgs this_ptr) {
index 7bb8249973227d970eee2af2b98cc33f098a94c2..6fe90d57c5b4759a9ed046544bbfa9fb4612530b 100644 (file)
@@ -7,7 +7,8 @@ public class ChannelMonitor extends CommonBase {
        ChannelMonitor(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.ChannelMonitor_free(ptr); super.finalize();
+               super.finalize();
+               bindings.ChannelMonitor_free(ptr);
        }
 
        // Skipped ChannelMonitor_update_monitor
index fdf417d501b05f9bf7dea5101ed034cc546e0f40..7aabae2fe7f9176eabc38dbda60cda2e3631ee5b 100644 (file)
@@ -7,7 +7,8 @@ public class ChannelMonitorUpdate extends CommonBase {
        ChannelMonitorUpdate(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.ChannelMonitorUpdate_free(ptr); super.finalize();
+               super.finalize();
+               bindings.ChannelMonitorUpdate_free(ptr);
        }
 
        public ChannelMonitorUpdate(ChannelMonitorUpdate orig) {
index 45fbc7d8052601262d03ef294495487b528f5808..e62ea44fdff8d4cc7aa3e11ccd8bad2304f256ee 100644 (file)
@@ -7,7 +7,8 @@ public class ChannelPublicKeys extends CommonBase {
        ChannelPublicKeys(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.ChannelPublicKeys_free(ptr); super.finalize();
+               super.finalize();
+               bindings.ChannelPublicKeys_free(ptr);
        }
 
        public ChannelPublicKeys(ChannelPublicKeys orig) {
index 476c924518f351ec413894dcc732e6ed7420dbd9..97f72ee37027872139ab36147215ed1354b37466 100644 (file)
@@ -7,7 +7,8 @@ public class ChannelReestablish extends CommonBase {
        ChannelReestablish(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.ChannelReestablish_free(ptr); super.finalize();
+               super.finalize();
+               bindings.ChannelReestablish_free(ptr);
        }
 
        public ChannelReestablish(ChannelReestablish orig) {
index 5dc086156f02762082b7e94d083c1393572b8b63..d4b306b4f2a3959ddd3e62506ebda83a88c20ace 100644 (file)
@@ -7,7 +7,8 @@ public class ChannelUpdate extends CommonBase {
        ChannelUpdate(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.ChannelUpdate_free(ptr); super.finalize();
+               super.finalize();
+               bindings.ChannelUpdate_free(ptr);
        }
 
        public ChannelUpdate(ChannelUpdate orig) {
index 4d30d0b20795b21faa7a0c4e4ba547e21b588d6a..4f9608282cefb185edf88acfe4693f23889a7214 100644 (file)
@@ -7,7 +7,8 @@ public class ClosingSigned extends CommonBase {
        ClosingSigned(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.ClosingSigned_free(ptr); super.finalize();
+               super.finalize();
+               bindings.ClosingSigned_free(ptr);
        }
 
        public ClosingSigned(ClosingSigned orig) {
index 1a8b6aa7bb812bd912ef2882ddcc5fbb62be5222..db4b65d063358ca4a90f9d52f02ae7425834476f 100644 (file)
@@ -7,7 +7,8 @@ public class CommitmentSigned extends CommonBase {
        CommitmentSigned(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.CommitmentSigned_free(ptr); super.finalize();
+               super.finalize();
+               bindings.CommitmentSigned_free(ptr);
        }
 
        public CommitmentSigned(CommitmentSigned orig) {
index a5de9e9d07b0cf0001ed8ac2e295d6642e9053ae..9f8c7a7a8521bf18e97122f6ff21136157b96401 100644 (file)
@@ -7,7 +7,8 @@ public class CommitmentUpdate extends CommonBase {
        CommitmentUpdate(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.CommitmentUpdate_free(ptr); super.finalize();
+               super.finalize();
+               bindings.CommitmentUpdate_free(ptr);
        }
 
        public CommitmentUpdate(CommitmentUpdate orig) {
index 47f90cf9a0d95e91c8d3eec9a6992fd1eb143113..f4bf70f164b08645378e012209d111c574adc9ec 100644 (file)
@@ -7,7 +7,8 @@ public class DataLossProtect extends CommonBase {
        DataLossProtect(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.DataLossProtect_free(ptr); super.finalize();
+               super.finalize();
+               bindings.DataLossProtect_free(ptr);
        }
 
        public DataLossProtect(DataLossProtect orig) {
index dddda1979b17d6aa9d72daea4ebaf16d45583cd5..71ff6155dda4ec202a3d7f8cc8d4cbbc214e16ad 100644 (file)
@@ -7,7 +7,8 @@ public class DecodeError extends CommonBase {
        DecodeError(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.DecodeError_free(ptr); super.finalize();
+               super.finalize();
+               bindings.DecodeError_free(ptr);
        }
 
 }
index c708cbed48f4597aa61d40f7b284b2f9e685e6fd..a1845552c9807b9dd0786b906a23803ccbc8e665 100644 (file)
@@ -7,7 +7,8 @@ public class DirectionalChannelInfo extends CommonBase {
        DirectionalChannelInfo(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.DirectionalChannelInfo_free(ptr); super.finalize();
+               super.finalize();
+               bindings.DirectionalChannelInfo_free(ptr);
        }
 
        public int get_last_update(DirectionalChannelInfo this_ptr) {
index b63931d68a0c82e47a9da5235ac74d21009aa4b4..6d7494fa20c036d77abacd9a2768080b8a1430dd 100644 (file)
@@ -7,7 +7,8 @@ public class ErrorMessage extends CommonBase {
        ErrorMessage(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.ErrorMessage_free(ptr); super.finalize();
+               super.finalize();
+               bindings.ErrorMessage_free(ptr);
        }
 
        public ErrorMessage(ErrorMessage orig) {
index e199467cbe3b083c3f5308c1bae80f8d8daff1b3..adf4275ce3c47f10cf3cf3d1ef59467e095a5536 100644 (file)
@@ -7,7 +7,8 @@ public class FundingCreated extends CommonBase {
        FundingCreated(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.FundingCreated_free(ptr); super.finalize();
+               super.finalize();
+               bindings.FundingCreated_free(ptr);
        }
 
        public FundingCreated(FundingCreated orig) {
index 1cd857e7ca468c08fa312f850086195a67d43c5b..6b8f5b99dcae99c08eac7f272eabbcb531a93a91 100644 (file)
@@ -7,7 +7,8 @@ public class FundingLocked extends CommonBase {
        FundingLocked(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.FundingLocked_free(ptr); super.finalize();
+               super.finalize();
+               bindings.FundingLocked_free(ptr);
        }
 
        public FundingLocked(FundingLocked orig) {
index 528194345d2488e6ff4105db2d223a8e8517e9ee..f0b2fa8c3579c4ef08be9ee79b15cfc6dca4933a 100644 (file)
@@ -7,7 +7,8 @@ public class FundingSigned extends CommonBase {
        FundingSigned(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.FundingSigned_free(ptr); super.finalize();
+               super.finalize();
+               bindings.FundingSigned_free(ptr);
        }
 
        public FundingSigned(FundingSigned orig) {
index 5d5cc30b5df61dbf8d46cee809db2d5991d02cea..862b477f61d0f631bd440407fe6f8869bc51ddbc 100644 (file)
@@ -7,7 +7,8 @@ public class GossipTimestampFilter extends CommonBase {
        GossipTimestampFilter(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.GossipTimestampFilter_free(ptr); super.finalize();
+               super.finalize();
+               bindings.GossipTimestampFilter_free(ptr);
        }
 
        public GossipTimestampFilter(GossipTimestampFilter orig) {
index d25beabeb4a3553e665586f771c7bf00b61e3b73..9cf880099a143d7a78c390bea5d5d74753cce21d 100644 (file)
@@ -7,7 +7,8 @@ public class HTLCOutputInCommitment extends CommonBase {
        HTLCOutputInCommitment(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.HTLCOutputInCommitment_free(ptr); super.finalize();
+               super.finalize();
+               bindings.HTLCOutputInCommitment_free(ptr);
        }
 
        public HTLCOutputInCommitment(HTLCOutputInCommitment orig) {
index 01e06eb7bd8f6623eda25a30b7e7d707805353d6..c8751fd35b51296315e741f6201115a28e4fa9b5 100644 (file)
@@ -7,7 +7,8 @@ public class HTLCUpdate extends CommonBase {
        HTLCUpdate(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.HTLCUpdate_free(ptr); super.finalize();
+               super.finalize();
+               bindings.HTLCUpdate_free(ptr);
        }
 
        public HTLCUpdate(HTLCUpdate orig) {
index aa729ac7d91ce971df9061a03a4e3d9cee1b2905..9751cebc4c57c6fa7c55746c9d9bf7b13e8c6a85 100644 (file)
@@ -7,7 +7,8 @@ public class HolderCommitmentTransaction extends CommonBase {
        HolderCommitmentTransaction(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.HolderCommitmentTransaction_free(ptr); super.finalize();
+               super.finalize();
+               bindings.HolderCommitmentTransaction_free(ptr);
        }
 
        public HolderCommitmentTransaction(HolderCommitmentTransaction orig) {
index 1740e663900f07d61e002cc6274beba34e1d4ae3..792c752754c63360ca7c20fbe68204ef56805762 100644 (file)
@@ -7,7 +7,8 @@ public class InMemoryChannelKeys extends CommonBase {
        InMemoryChannelKeys(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.InMemoryChannelKeys_free(ptr); super.finalize();
+               super.finalize();
+               bindings.InMemoryChannelKeys_free(ptr);
        }
 
        public InMemoryChannelKeys(InMemoryChannelKeys orig) {
index 576e95c3aa22d985ec09cb4529b99fbf498a86f9..491e692ac0b6d73ba4721d53e30fb0436cad0ca1 100644 (file)
@@ -7,7 +7,8 @@ public class Init extends CommonBase {
        Init(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.Init_free(ptr); super.finalize();
+               super.finalize();
+               bindings.Init_free(ptr);
        }
 
        public Init(Init orig) {
index 153f088f0a9657483c261eefb4132f06af4a5fcf..4310438e0a266bc33964e8286f79a9552ecc57f1 100644 (file)
@@ -7,7 +7,8 @@ public class InitFeatures extends CommonBase {
        InitFeatures(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.InitFeatures_free(ptr); super.finalize();
+               super.finalize();
+               bindings.InitFeatures_free(ptr);
        }
 
 }
index ca95138ed299d828e33b5aaa4b496503c602499a..da59e4350ea1688ebc6b098bafd15265a769f3db 100644 (file)
@@ -7,7 +7,8 @@ public class KeysManager extends CommonBase {
        KeysManager(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.KeysManager_free(ptr); super.finalize();
+               super.finalize();
+               bindings.KeysManager_free(ptr);
        }
 
        public KeysManager(byte[] seed, LDKNetwork network, long starting_time_secs, int starting_time_nanos) {
index 5f7391f67c2686f0ba7a6b141824a8484fe270f3..4db4ea097b2837e121d3ac6a8a48811e2c67dca4 100644 (file)
@@ -7,7 +7,8 @@ public class LightningError extends CommonBase {
        LightningError(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.LightningError_free(ptr); super.finalize();
+               super.finalize();
+               bindings.LightningError_free(ptr);
        }
 
        // Skipped LightningError_get_err
index 3f1684a94d2d110a0e464e27d0dd357b808a72c3..614a5d969cb9db9b4675181edbe110b9d0a76ae5 100644 (file)
@@ -3,11 +3,10 @@ package org.ldk.structs;
 import org.ldk.impl.bindings;
 import org.ldk.enums.*;
 
-public class LockedNetworkGraph extends CommonBase {
+public class LockedNetworkGraph extends CommonBase implements AutoCloseable {
        LockedNetworkGraph(Object _dummy, long ptr) { super(ptr); }
-       @Override @SuppressWarnings("deprecation")
-       protected void finalize() throws Throwable {
-               bindings.LockedNetworkGraph_free(ptr); super.finalize();
+       @Override public void close() {
+               bindings.LockedNetworkGraph_free(ptr);
        }
 
        public NetworkGraph graph() {
index b6246cd431e8044235d50bc4462dad8878a809e5..736bac893808460d28e9b9626c8a4439818e1f91 100644 (file)
@@ -7,7 +7,8 @@ public class MessageHandler extends CommonBase {
        MessageHandler(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.MessageHandler_free(ptr); super.finalize();
+               super.finalize();
+               bindings.MessageHandler_free(ptr);
        }
 
        public ChannelMessageHandler get_chan_handler(MessageHandler this_ptr) {
index d425905448865c8f03802bd5ae7e4ebb5d7c2fbf..35adb837ef40110da1dbd9c2140aecdcf6463a24 100644 (file)
@@ -7,7 +7,8 @@ public class MonitorEvent extends CommonBase {
        MonitorEvent(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.MonitorEvent_free(ptr); super.finalize();
+               super.finalize();
+               bindings.MonitorEvent_free(ptr);
        }
 
 }
index f56c45a534c1a143b463e9fb09ed286f572e1529..bd0eefc8f882322451ba46913ed52ad53102d813 100644 (file)
@@ -7,7 +7,8 @@ public class MonitorUpdateError extends CommonBase {
        MonitorUpdateError(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.MonitorUpdateError_free(ptr); super.finalize();
+               super.finalize();
+               bindings.MonitorUpdateError_free(ptr);
        }
 
 }
index b475109ba49f0606076ee892464e090a41c31bd7..bb976f659d072e25f1fedf63b77a9c9b40d31ac4 100644 (file)
@@ -7,7 +7,8 @@ public class NetGraphMsgHandler extends CommonBase {
        NetGraphMsgHandler(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.NetGraphMsgHandler_free(ptr); super.finalize();
+               super.finalize();
+               bindings.NetGraphMsgHandler_free(ptr);
        }
 
        public NetGraphMsgHandler(Access chain_access, Logger logger) {
index e2f64ee0df12b35a1a4fd698de2a5447c0f4f62f..f18a9645e548508a98ca0fde0d5960891a9066b6 100644 (file)
@@ -7,7 +7,8 @@ public class NetworkGraph extends CommonBase {
        NetworkGraph(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.NetworkGraph_free(ptr); super.finalize();
+               super.finalize();
+               bindings.NetworkGraph_free(ptr);
        }
 
        // Skipped NetworkGraph_write
index b114815fbef867cb40caf4acd7d485202d07f33d..019017c338722170a7d483b453e019d4b916ccbd 100644 (file)
@@ -7,7 +7,8 @@ public class NodeAnnouncement extends CommonBase {
        NodeAnnouncement(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.NodeAnnouncement_free(ptr); super.finalize();
+               super.finalize();
+               bindings.NodeAnnouncement_free(ptr);
        }
 
        public NodeAnnouncement(NodeAnnouncement orig) {
index fe13f99f74c39bb0e84072ac494ecf7d68f69817..e9a35ffb9f1126a5867466b96a125b0af5d058fb 100644 (file)
@@ -7,7 +7,8 @@ public class NodeAnnouncementInfo extends CommonBase {
        NodeAnnouncementInfo(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.NodeAnnouncementInfo_free(ptr); super.finalize();
+               super.finalize();
+               bindings.NodeAnnouncementInfo_free(ptr);
        }
 
        public NodeFeatures get_features(NodeAnnouncementInfo this_ptr) {
index fe418ad36020d44409c3ba3513012c174cd2f526..a901668044b4ccd0fc830c0280f156f53543010b 100644 (file)
@@ -7,7 +7,8 @@ public class NodeFeatures extends CommonBase {
        NodeFeatures(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.NodeFeatures_free(ptr); super.finalize();
+               super.finalize();
+               bindings.NodeFeatures_free(ptr);
        }
 
 }
index acfc3c4cfc5de955be637754487e4c96c0801ad2..4812f2f36160ba77c9e30d9a48b70e91b0564051 100644 (file)
@@ -7,7 +7,8 @@ public class NodeInfo extends CommonBase {
        NodeInfo(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.NodeInfo_free(ptr); super.finalize();
+               super.finalize();
+               bindings.NodeInfo_free(ptr);
        }
 
        // Skipped NodeInfo_set_channels
index 87e7d1795661f86376ef0d552db323859807b8f4..e497933d3ba5080be88b840868c6e9db53daf6cd 100644 (file)
@@ -7,7 +7,8 @@ public class OpenChannel extends CommonBase {
        OpenChannel(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.OpenChannel_free(ptr); super.finalize();
+               super.finalize();
+               bindings.OpenChannel_free(ptr);
        }
 
        public OpenChannel(OpenChannel orig) {
index 18229e76210dc76a254c4f056ca87ae3357e8da7..12fffe1640066d52d07b20d2df1f39f31006f84e 100644 (file)
@@ -7,7 +7,8 @@ public class OutPoint extends CommonBase {
        OutPoint(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.OutPoint_free(ptr); super.finalize();
+               super.finalize();
+               bindings.OutPoint_free(ptr);
        }
 
        public OutPoint(OutPoint orig) {
index 7eb6a56a2beee48d403d3087d958d0d78dc15dc2..1df65ed02d8f2b111c6afca8d98798d1679eba98 100644 (file)
@@ -7,7 +7,8 @@ public class PaymentSendFailure extends CommonBase {
        PaymentSendFailure(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.PaymentSendFailure_free(ptr); super.finalize();
+               super.finalize();
+               bindings.PaymentSendFailure_free(ptr);
        }
 
 }
index 24c350e8606c9ae0692fe5734cd3a235866f9952..6586e91c857101551b9b84f5491d7ee729beb691 100644 (file)
@@ -7,7 +7,8 @@ public class PeerHandleError extends CommonBase {
        PeerHandleError(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.PeerHandleError_free(ptr); super.finalize();
+               super.finalize();
+               bindings.PeerHandleError_free(ptr);
        }
 
        public boolean get_no_connection_possible(PeerHandleError this_ptr) {
index 54b4e723658576cd5cf6e2700b1fcf9130098917..319b979e7ff0712fc902bcb352ed61675ea6e4d7 100644 (file)
@@ -7,7 +7,8 @@ public class PeerManager extends CommonBase {
        PeerManager(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.PeerManager_free(ptr); super.finalize();
+               super.finalize();
+               bindings.PeerManager_free(ptr);
        }
 
        public PeerManager(ChannelMessageHandler message_handler_chan_handler_arg, RoutingMessageHandler message_handler_route_handler_arg, byte[] our_node_secret, byte[] ephemeral_random_data, Logger logger) {
index e0e1b3d541ac1cddaf789d5a36d77c699540a9eb..a6cc369b4ab0a1a38611b1dc8d008626c31cd022 100644 (file)
@@ -7,7 +7,8 @@ public class Ping extends CommonBase {
        Ping(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.Ping_free(ptr); super.finalize();
+               super.finalize();
+               bindings.Ping_free(ptr);
        }
 
        public Ping(Ping orig) {
index 0ddec80cf976e41887b64b32950f3fd981738e9f..a674d05ab9f0b0a932d6ec74b44c99072e359275 100644 (file)
@@ -7,7 +7,8 @@ public class Pong extends CommonBase {
        Pong(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.Pong_free(ptr); super.finalize();
+               super.finalize();
+               bindings.Pong_free(ptr);
        }
 
        public Pong(Pong orig) {
index 2a88b8692aac1d77bd442addeb496af051bf7de6..2622239388109cbd237609f979fb2acbab96f35c 100644 (file)
@@ -7,7 +7,8 @@ public class PreCalculatedTxCreationKeys extends CommonBase {
        PreCalculatedTxCreationKeys(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.PreCalculatedTxCreationKeys_free(ptr); super.finalize();
+               super.finalize();
+               bindings.PreCalculatedTxCreationKeys_free(ptr);
        }
 
        public PreCalculatedTxCreationKeys(TxCreationKeys keys) {
index c1a8b3f2ca970a5cafa05bf97034d90d750fde79..9d15fee3512292d2c6967668eb63e52da63fc776 100644 (file)
@@ -7,7 +7,8 @@ public class QueryChannelRange extends CommonBase {
        QueryChannelRange(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.QueryChannelRange_free(ptr); super.finalize();
+               super.finalize();
+               bindings.QueryChannelRange_free(ptr);
        }
 
        public QueryChannelRange(QueryChannelRange orig) {
index 316e4f94688c2ad94cfe823185a261367c51bd01..e43f686d3cde5cf80ec2f30e09b1ebabb30822df 100644 (file)
@@ -7,7 +7,8 @@ public class QueryShortChannelIds extends CommonBase {
        QueryShortChannelIds(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.QueryShortChannelIds_free(ptr); super.finalize();
+               super.finalize();
+               bindings.QueryShortChannelIds_free(ptr);
        }
 
        public QueryShortChannelIds(QueryShortChannelIds orig) {
index 43ccf5d2a805b749ff57514ac7e292556c340aec..7d33ba4b029ae893d6de7f465f906b71d398c60a 100644 (file)
@@ -7,7 +7,8 @@ public class ReplyChannelRange extends CommonBase {
        ReplyChannelRange(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.ReplyChannelRange_free(ptr); super.finalize();
+               super.finalize();
+               bindings.ReplyChannelRange_free(ptr);
        }
 
        public ReplyChannelRange(ReplyChannelRange orig) {
index c04cd58abe436eb9b1262a6db40a7a7fe5dab85d..6ea3e72018c170a2a99c0270c593eeaa69f12e44 100644 (file)
@@ -7,7 +7,8 @@ public class ReplyShortChannelIdsEnd extends CommonBase {
        ReplyShortChannelIdsEnd(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.ReplyShortChannelIdsEnd_free(ptr); super.finalize();
+               super.finalize();
+               bindings.ReplyShortChannelIdsEnd_free(ptr);
        }
 
        public ReplyShortChannelIdsEnd(ReplyShortChannelIdsEnd orig) {
index d887797c49d8fea0c1392219fd940425dd3aeba5..1c7a4a039c7d1b0f6bf6a76bef8ddb0358b71e18 100644 (file)
@@ -7,7 +7,8 @@ public class RevokeAndACK extends CommonBase {
        RevokeAndACK(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.RevokeAndACK_free(ptr); super.finalize();
+               super.finalize();
+               bindings.RevokeAndACK_free(ptr);
        }
 
        public RevokeAndACK(RevokeAndACK orig) {
index dc1f964516ff5d56bb8399b4a57342b1a9525626..aa4dd12389620349073159b1d77fef04432406d2 100644 (file)
@@ -7,7 +7,8 @@ public class Route extends CommonBase {
        Route(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.Route_free(ptr); super.finalize();
+               super.finalize();
+               bindings.Route_free(ptr);
        }
 
        public Route(Route orig) {
index 71fdc7fee9a79cf5fcefe4de6e13c936ace49926..f7897200f43f2292ad2b41f504e54cbdb6b86d6a 100644 (file)
@@ -7,7 +7,8 @@ public class RouteHint extends CommonBase {
        RouteHint(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.RouteHint_free(ptr); super.finalize();
+               super.finalize();
+               bindings.RouteHint_free(ptr);
        }
 
        public RouteHint(RouteHint orig) {
index 814ebe5a73dd55ccacd27419e371ae53ac44f1b7..a094d172fab0f112d086d85d7e8464eb2af7c7e2 100644 (file)
@@ -7,7 +7,8 @@ public class RouteHop extends CommonBase {
        RouteHop(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.RouteHop_free(ptr); super.finalize();
+               super.finalize();
+               bindings.RouteHop_free(ptr);
        }
 
        public RouteHop(RouteHop orig) {
index 59f65ce5763cd066ed4601f115421f7332ed4f61..80183bb91bfb1b7508f22d4538aa6883891ba9a5 100644 (file)
@@ -7,7 +7,8 @@ public class RoutingFees extends CommonBase {
        RoutingFees(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.RoutingFees_free(ptr); super.finalize();
+               super.finalize();
+               bindings.RoutingFees_free(ptr);
        }
 
        public RoutingFees(RoutingFees orig) {
index 8c690a9d3aba4379622f9a5e9fbd25dc428d1903..d1b08971c69b16ad1e34d17184fb370ed44fe3d8 100644 (file)
@@ -7,7 +7,8 @@ public class Shutdown extends CommonBase {
        Shutdown(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.Shutdown_free(ptr); super.finalize();
+               super.finalize();
+               bindings.Shutdown_free(ptr);
        }
 
        public Shutdown(Shutdown orig) {
index 39849ae595abcc7920e848751c7998c5d7747501..0e2cc4ae0f11ac4e8440502f20a7338a99af1236 100644 (file)
@@ -7,7 +7,8 @@ public class TxCreationKeys extends CommonBase {
        TxCreationKeys(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.TxCreationKeys_free(ptr); super.finalize();
+               super.finalize();
+               bindings.TxCreationKeys_free(ptr);
        }
 
        public TxCreationKeys(TxCreationKeys orig) {
index 7af521468be8d32d318b08241c7696c1b45c6beb..e11c520cc850f4e9ef5a28cd5cc7479a78c849a6 100644 (file)
@@ -7,7 +7,8 @@ public class UnsignedChannelAnnouncement extends CommonBase {
        UnsignedChannelAnnouncement(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.UnsignedChannelAnnouncement_free(ptr); super.finalize();
+               super.finalize();
+               bindings.UnsignedChannelAnnouncement_free(ptr);
        }
 
        public UnsignedChannelAnnouncement(UnsignedChannelAnnouncement orig) {
index f56cca90d569a01000236546e098cbf054224e15..b3520d3389948ec306dbe7f77af578ab3d21d5d9 100644 (file)
@@ -7,7 +7,8 @@ public class UnsignedChannelUpdate extends CommonBase {
        UnsignedChannelUpdate(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.UnsignedChannelUpdate_free(ptr); super.finalize();
+               super.finalize();
+               bindings.UnsignedChannelUpdate_free(ptr);
        }
 
        public UnsignedChannelUpdate(UnsignedChannelUpdate orig) {
index 3a20d82091d4118f0690b0b9e23b85fcd3df4e1c..adee1f6653b70ba742079136bc24ed18014256c9 100644 (file)
@@ -7,7 +7,8 @@ public class UnsignedNodeAnnouncement extends CommonBase {
        UnsignedNodeAnnouncement(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.UnsignedNodeAnnouncement_free(ptr); super.finalize();
+               super.finalize();
+               bindings.UnsignedNodeAnnouncement_free(ptr);
        }
 
        public UnsignedNodeAnnouncement(UnsignedNodeAnnouncement orig) {
index adca17e6c197965b74d1690576c64d2f37da2bc0..86bb2b4108f3c73eb4c342fe68deb4a9a2a30759 100644 (file)
@@ -7,7 +7,8 @@ public class UpdateAddHTLC extends CommonBase {
        UpdateAddHTLC(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.UpdateAddHTLC_free(ptr); super.finalize();
+               super.finalize();
+               bindings.UpdateAddHTLC_free(ptr);
        }
 
        public UpdateAddHTLC(UpdateAddHTLC orig) {
index b1cb03290b8e7952b4a66ba17133e25b54f0b6b7..50147508fdcd19a2fc6f618437ef4c2f19f93aff 100644 (file)
@@ -7,7 +7,8 @@ public class UpdateFailHTLC extends CommonBase {
        UpdateFailHTLC(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.UpdateFailHTLC_free(ptr); super.finalize();
+               super.finalize();
+               bindings.UpdateFailHTLC_free(ptr);
        }
 
        public UpdateFailHTLC(UpdateFailHTLC orig) {
index 8f414a988fe0f31bc03b05e775f2a7674ff7b498..66e394dd494186a999bef0708757139894ab0007 100644 (file)
@@ -7,7 +7,8 @@ public class UpdateFailMalformedHTLC extends CommonBase {
        UpdateFailMalformedHTLC(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.UpdateFailMalformedHTLC_free(ptr); super.finalize();
+               super.finalize();
+               bindings.UpdateFailMalformedHTLC_free(ptr);
        }
 
        public UpdateFailMalformedHTLC(UpdateFailMalformedHTLC orig) {
index 9fd24408dbfa2100535dd7519b456d9e5b9880a0..9756771bd8f6280f6514c103a4bd898c80c40cea 100644 (file)
@@ -7,7 +7,8 @@ public class UpdateFee extends CommonBase {
        UpdateFee(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.UpdateFee_free(ptr); super.finalize();
+               super.finalize();
+               bindings.UpdateFee_free(ptr);
        }
 
        public UpdateFee(UpdateFee orig) {
index 96f5843009b78535d63049e591ac71682600af53..5bb0940ac90a5aa8f109d82ab4ba7f4225eafe31 100644 (file)
@@ -7,7 +7,8 @@ public class UpdateFulfillHTLC extends CommonBase {
        UpdateFulfillHTLC(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.UpdateFulfillHTLC_free(ptr); super.finalize();
+               super.finalize();
+               bindings.UpdateFulfillHTLC_free(ptr);
        }
 
        public UpdateFulfillHTLC(UpdateFulfillHTLC orig) {
index a22d021b2fe6fa6c53de5416805c9770ce57c097..5ebd15c9348842b7684f106e33906dd9f2888191 100644 (file)
@@ -7,7 +7,8 @@ public class UserConfig extends CommonBase {
        UserConfig(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.UserConfig_free(ptr); super.finalize();
+               super.finalize();
+               bindings.UserConfig_free(ptr);
        }
 
        public UserConfig(UserConfig orig) {
index 935eadb9daaa868777f838b1a96b591521b45d2d..8103b23c46e87ea3c7f286a5674bd7364c781858 100644 (file)
@@ -127,11 +127,12 @@ public class HumanObjectPeerTest {
         }
 
         long get_route(byte[] dest_node, long our_chans) {
-            LockedNetworkGraph netgraph = this.router.read_locked_graph();
-            //r = new WeakReference(netgraph);
-            NetworkGraph graph = netgraph.graph();
-            return bindings.get_route(this.node_id, graph._test_only_get_ptr(), dest_node, our_chans,
-                    bindings.LDKCVecTempl_RouteHint_new(new long[0]), 1000, 42, this.logger);
+            try (LockedNetworkGraph netgraph = this.router.read_locked_graph()) {
+                //r = new WeakReference(netgraph);
+                NetworkGraph graph = netgraph.graph();
+                return bindings.get_route(this.node_id, graph._test_only_get_ptr(), dest_node, our_chans,
+                        bindings.LDKCVecTempl_RouteHint_new(new long[0]), 1000, 42, this.logger);
+            }
         }
     }
 
@@ -273,8 +274,6 @@ public class HumanObjectPeerTest {
         for (int i = 0; i < 32; i++) payment_preimage[i] = (byte) (i ^ 0x0f);
         byte[] payment_hash = Sha256Hash.hash(payment_preimage);
         long route = peer1.get_route(peer2.node_id, peer1_chans);
-        System.gc(); // Force the lock to release that we took in get_route - we need something better here!
-        System.runFinalization();
         bindings.CVec_ChannelDetailsZ_free(peer1_chans);
         assert bindings.LDKCResult_RouteLightningErrorZ_result_ok(route);
         long payment_res = bindings.ChannelManager_send_payment(peer1.chan_manager._test_only_get_ptr(), bindings.LDKCResult_RouteLightningErrorZ_get_inner(route), payment_hash, new byte[32]);