[Java] Update auto-generated Java bindings
[ldk-java] / src / main / java / org / ldk / structs / Ping.java
index 4ef0ce5f7166be7a42b8a237f478e99c69dbcf23..fc20cc32ee5a3f41eb966bfce6773b10e54ca7c4 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;
 
 
@@ -24,6 +25,7 @@ public class Ping extends CommonBase {
         */
        public short get_ponglen() {
                short ret = bindings.Ping_get_ponglen(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
@@ -32,6 +34,8 @@ public class Ping extends CommonBase {
         */
        public void set_ponglen(short val) {
                bindings.Ping_set_ponglen(this.ptr, val);
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(val);
        }
 
        /**
@@ -40,6 +44,7 @@ public class Ping extends CommonBase {
         */
        public short get_byteslen() {
                short ret = bindings.Ping_get_byteslen(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
@@ -49,6 +54,8 @@ public class Ping extends CommonBase {
         */
        public void set_byteslen(short val) {
                bindings.Ping_set_byteslen(this.ptr, val);
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(val);
        }
 
        /**
@@ -56,28 +63,55 @@ public class Ping extends CommonBase {
         */
        public static Ping of(short ponglen_arg, short byteslen_arg) {
                long ret = bindings.Ping_new(ponglen_arg, byteslen_arg);
+               Reference.reachabilityFence(ponglen_arg);
+               Reference.reachabilityFence(byteslen_arg);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Ping ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Ping(null, ret); }
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               org.ldk.structs.Ping ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Ping(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
+       long clone_ptr() {
+               long ret = bindings.Ping_clone_ptr(this.ptr);
+               Reference.reachabilityFence(this);
+               return ret;
+       }
+
        /**
         * Creates a copy of the Ping
         */
        public Ping clone() {
                long ret = bindings.Ping_clone(this.ptr);
+               Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Ping ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Ping(null, ret); }
-               ret_hu_conv.ptrs_to.add(this);
+               org.ldk.structs.Ping ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Ping(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
+       /**
+        * Checks if two Pings contain equal inner contents.
+        * This ignores pointers and is_owned flags and looks at the values in fields.
+        * Two objects with NULL inner values will be considered "equal" here.
+        */
+       public boolean eq(Ping b) {
+               boolean ret = bindings.Ping_eq(this.ptr, b == null ? 0 : b.ptr);
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(b);
+               if (this != null) { this.ptrs_to.add(b); };
+               return ret;
+       }
+
+       @Override public boolean equals(Object o) {
+               if (!(o instanceof Ping)) return false;
+               return this.eq((Ping)o);
+       }
        /**
         * Serialize the Ping object into a byte array which can be read by Ping_read
         */
        public byte[] write() {
                byte[] ret = bindings.Ping_write(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }
 
@@ -86,6 +120,7 @@ public class Ping extends CommonBase {
         */
        public static Result_PingDecodeErrorZ read(byte[] ser) {
                long ret = bindings.Ping_read(ser);
+               Reference.reachabilityFence(ser);
                if (ret >= 0 && ret <= 4096) { return null; }
                Result_PingDecodeErrorZ ret_hu_conv = Result_PingDecodeErrorZ.constr_from_ptr(ret);
                return ret_hu_conv;