[Java] Update auto-generated bindings to LDK 0.0.123
[ldk-java] / src / main / java / org / ldk / structs / SignOrCreationError.java
index f087a97c85d787cc4391474dcc90e59ea0b848bc..70437b37dd3ca5ef1a1bdf28de70435805bdd40f 100644 (file)
@@ -4,11 +4,12 @@ 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;
 
 
 /**
- * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
+ * When signing using a fallible method either an user-supplied `SignError` or a [`CreationError`]
  * may occur.
  */
 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
@@ -30,11 +31,17 @@ public class SignOrCreationError extends CommonBase {
                assert false; return null; // Unreachable without extending the (internal) bindings interface
        }
 
+       /**
+        * An error occurred during signing
+        */
        public final static class SignError extends SignOrCreationError {
                private SignError(long ptr, bindings.LDKSignOrCreationError.SignError obj) {
                        super(null, ptr);
                }
        }
+       /**
+        * An error occurred while building the transaction
+        */
        public final static class CreationError extends SignOrCreationError {
                public final org.ldk.enums.CreationError creation_error;
                private CreationError(long ptr, bindings.LDKSignOrCreationError.CreationError obj) {
@@ -42,14 +49,21 @@ public class SignOrCreationError extends CommonBase {
                        this.creation_error = obj.creation_error;
                }
        }
+       long clone_ptr() {
+               long ret = bindings.SignOrCreationError_clone_ptr(this.ptr);
+               Reference.reachabilityFence(this);
+               return ret;
+       }
+
        /**
         * Creates a copy of the SignOrCreationError
         */
        public SignOrCreationError clone() {
                long ret = bindings.SignOrCreationError_clone(this.ptr);
-               if (ret < 1024) { return null; }
-               SignOrCreationError ret_hu_conv = SignOrCreationError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(this);
+               Reference.reachabilityFence(this);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               org.ldk.structs.SignOrCreationError ret_hu_conv = org.ldk.structs.SignOrCreationError.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
@@ -58,9 +72,9 @@ public class SignOrCreationError extends CommonBase {
         */
        public static SignOrCreationError sign_error() {
                long ret = bindings.SignOrCreationError_sign_error();
-               if (ret < 1024) { return null; }
-               SignOrCreationError ret_hu_conv = SignOrCreationError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               org.ldk.structs.SignOrCreationError ret_hu_conv = org.ldk.structs.SignOrCreationError.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -69,9 +83,10 @@ public class SignOrCreationError extends CommonBase {
         */
        public static SignOrCreationError creation_error(org.ldk.enums.CreationError a) {
                long ret = bindings.SignOrCreationError_creation_error(a);
-               if (ret < 1024) { return null; }
-               SignOrCreationError ret_hu_conv = SignOrCreationError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               Reference.reachabilityFence(a);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               org.ldk.structs.SignOrCreationError ret_hu_conv = org.ldk.structs.SignOrCreationError.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -79,17 +94,23 @@ public class SignOrCreationError extends CommonBase {
         * Checks if two SignOrCreationErrors contain equal inner contents.
         * This ignores pointers and is_owned flags and looks at the values in fields.
         */
-       public boolean eq(SignOrCreationError b) {
-               boolean ret = bindings.SignOrCreationError_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
-               this.ptrs_to.add(b);
+       public boolean eq(org.ldk.structs.SignOrCreationError b) {
+               boolean ret = bindings.SignOrCreationError_eq(this.ptr, b.ptr);
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(b);
                return ret;
        }
 
+       @Override public boolean equals(Object o) {
+               if (!(o instanceof SignOrCreationError)) return false;
+               return this.eq((SignOrCreationError)o);
+       }
        /**
         * Get the string representation of a SignOrCreationError object
         */
        public String to_str() {
                String ret = bindings.SignOrCreationError_to_str(this.ptr);
+               Reference.reachabilityFence(this);
                return ret;
        }