[Java] Update auto-generated Java bindings
[ldk-java] / src / main / java / org / ldk / structs / Persist.java
index 335576fca31b1d18820009aaef758c8c06f2678c..0e7f53b73c72f2b0406c4063f43c134915e5c96a 100644 (file)
@@ -4,6 +4,7 @@ import org.ldk.impl.bindings;
 import org.ldk.enums.*;
 import org.ldk.util.*;
 import java.util.Arrays;
+import java.lang.ref.Reference;
 import javax.annotation.Nullable;
 
 /**
@@ -104,24 +105,26 @@ public class Persist extends CommonBase {
                final LDKPersistHolder impl_holder = new LDKPersistHolder();
                impl_holder.held = new Persist(new bindings.LDKPersist() {
                        @Override public long persist_new_channel(long channel_id, long data, long update_id) {
-                               OutPoint channel_id_hu_conv = null; if (channel_id < 0 || channel_id > 4096) { channel_id_hu_conv = new OutPoint(null, channel_id); }
+                               org.ldk.structs.OutPoint channel_id_hu_conv = null; if (channel_id < 0 || channel_id > 4096) { channel_id_hu_conv = new org.ldk.structs.OutPoint(null, channel_id); }
                                channel_id_hu_conv.ptrs_to.add(this);
-                               ChannelMonitor data_hu_conv = null; if (data < 0 || data > 4096) { data_hu_conv = new ChannelMonitor(null, data); }
-                               MonitorUpdateId update_id_hu_conv = null; if (update_id < 0 || update_id > 4096) { update_id_hu_conv = new MonitorUpdateId(null, update_id); }
+                               org.ldk.structs.ChannelMonitor data_hu_conv = null; if (data < 0 || data > 4096) { data_hu_conv = new org.ldk.structs.ChannelMonitor(null, data); }
+                               org.ldk.structs.MonitorUpdateId update_id_hu_conv = null; if (update_id < 0 || update_id > 4096) { update_id_hu_conv = new org.ldk.structs.MonitorUpdateId(null, update_id); }
                                update_id_hu_conv.ptrs_to.add(this);
                                Result_NoneChannelMonitorUpdateErrZ ret = arg.persist_new_channel(channel_id_hu_conv, data_hu_conv, update_id_hu_conv);
-                               long result = ret != null ? ret.ptr : 0;
+                               Reference.reachabilityFence(arg);
+                               long result = ret == null ? 0 : ret.clone_ptr();
                                return result;
                        }
                        @Override public long update_persisted_channel(long channel_id, long update, long data, long update_id) {
-                               OutPoint channel_id_hu_conv = null; if (channel_id < 0 || channel_id > 4096) { channel_id_hu_conv = new OutPoint(null, channel_id); }
+                               org.ldk.structs.OutPoint channel_id_hu_conv = null; if (channel_id < 0 || channel_id > 4096) { channel_id_hu_conv = new org.ldk.structs.OutPoint(null, channel_id); }
                                channel_id_hu_conv.ptrs_to.add(this);
-                               ChannelMonitorUpdate update_hu_conv = null; if (update < 0 || update > 4096) { update_hu_conv = new ChannelMonitorUpdate(null, update); }
-                               ChannelMonitor data_hu_conv = null; if (data < 0 || data > 4096) { data_hu_conv = new ChannelMonitor(null, data); }
-                               MonitorUpdateId update_id_hu_conv = null; if (update_id < 0 || update_id > 4096) { update_id_hu_conv = new MonitorUpdateId(null, update_id); }
+                               org.ldk.structs.ChannelMonitorUpdate update_hu_conv = null; if (update < 0 || update > 4096) { update_hu_conv = new org.ldk.structs.ChannelMonitorUpdate(null, update); }
+                               org.ldk.structs.ChannelMonitor data_hu_conv = null; if (data < 0 || data > 4096) { data_hu_conv = new org.ldk.structs.ChannelMonitor(null, data); }
+                               org.ldk.structs.MonitorUpdateId update_id_hu_conv = null; if (update_id < 0 || update_id > 4096) { update_id_hu_conv = new org.ldk.structs.MonitorUpdateId(null, update_id); }
                                update_id_hu_conv.ptrs_to.add(this);
                                Result_NoneChannelMonitorUpdateErrZ ret = arg.update_persisted_channel(channel_id_hu_conv, update_hu_conv, data_hu_conv, update_id_hu_conv);
-                               long result = ret != null ? ret.ptr : 0;
+                               Reference.reachabilityFence(arg);
+                               long result = ret == null ? 0 : ret.clone_ptr();
                                return result;
                        }
                });
@@ -145,10 +148,16 @@ public class Persist extends CommonBase {
         * [`Writeable::write`]: crate::util::ser::Writeable::write
         */
        public Result_NoneChannelMonitorUpdateErrZ persist_new_channel(OutPoint channel_id, ChannelMonitor data, MonitorUpdateId update_id) {
-               long ret = bindings.Persist_persist_new_channel(this.ptr, channel_id == null ? 0 : channel_id.ptr & ~1, data == null ? 0 : data.ptr & ~1, update_id == null ? 0 : update_id.ptr & ~1);
+               long ret = bindings.Persist_persist_new_channel(this.ptr, channel_id == null ? 0 : channel_id.ptr, data == null ? 0 : data.ptr, update_id == null ? 0 : update_id.ptr);
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(channel_id);
+               Reference.reachabilityFence(data);
+               Reference.reachabilityFence(update_id);
                if (ret >= 0 && ret <= 4096) { return null; }
                Result_NoneChannelMonitorUpdateErrZ ret_hu_conv = Result_NoneChannelMonitorUpdateErrZ.constr_from_ptr(ret);
+               this.ptrs_to.add(channel_id);
                this.ptrs_to.add(data);
+               this.ptrs_to.add(update_id);
                return ret_hu_conv;
        }
 
@@ -190,11 +199,18 @@ public class Persist extends CommonBase {
         * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None
         */
        public Result_NoneChannelMonitorUpdateErrZ update_persisted_channel(OutPoint channel_id, @Nullable ChannelMonitorUpdate update, ChannelMonitor data, MonitorUpdateId update_id) {
-               long ret = bindings.Persist_update_persisted_channel(this.ptr, channel_id == null ? 0 : channel_id.ptr & ~1, update == null ? 0 : update.ptr & ~1, data == null ? 0 : data.ptr & ~1, update_id == null ? 0 : update_id.ptr & ~1);
+               long ret = bindings.Persist_update_persisted_channel(this.ptr, channel_id == null ? 0 : channel_id.ptr, update == null ? 0 : update.ptr, data == null ? 0 : data.ptr, update_id == null ? 0 : update_id.ptr);
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(channel_id);
+               Reference.reachabilityFence(update);
+               Reference.reachabilityFence(data);
+               Reference.reachabilityFence(update_id);
                if (ret >= 0 && ret <= 4096) { return null; }
                Result_NoneChannelMonitorUpdateErrZ ret_hu_conv = Result_NoneChannelMonitorUpdateErrZ.constr_from_ptr(ret);
+               this.ptrs_to.add(channel_id);
                this.ptrs_to.add(update);
                this.ptrs_to.add(data);
+               this.ptrs_to.add(update_id);
                return ret_hu_conv;
        }