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)
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) {
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) {
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
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) {
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) {
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) {
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);
}
}
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) {
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) {
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) {
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) {
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) {
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
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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);
}
}
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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);
}
}
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) {
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
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() {
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) {
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);
}
}
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);
}
}
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) {
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
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) {
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) {
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);
}
}
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
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) {
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) {
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);
}
}
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
}
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);
+ }
}
}
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]);