[Java] Update auto-generated Java bindings
[ldk-java] / src / main / java / org / ldk / structs / ParseError.java
index 940362e09f5584d2a1eca30af16ab963b5f93d23..36802c08030cde94a21f31e524f7dfecd60d89a6 100644 (file)
@@ -85,7 +85,7 @@ public class ParseError extends CommonBase {
                        super(null, ptr);
                        long bech32_error = obj.bech32_error;
                        org.ldk.structs.Bech32Error bech32_error_hu_conv = org.ldk.structs.Bech32Error.constr_from_ptr(bech32_error);
-                       bech32_error_hu_conv.ptrs_to.add(this);
+                       if (bech32_error_hu_conv != null) { bech32_error_hu_conv.ptrs_to.add(this); };
                        this.bech32_error = bech32_error_hu_conv;
                }
        }
@@ -204,31 +204,32 @@ public class ParseError extends CommonBase {
                Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(this);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
        /**
         * Utility method to constructs a new Bech32Error-variant ParseError
         */
-       public static ParseError bech32_error(Bech32Error a) {
+       public static ParseError bech32_error(org.ldk.structs.Bech32Error a) {
                long ret = bindings.ParseError_bech32_error(a.ptr);
                Reference.reachabilityFence(a);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); };
                return ret_hu_conv;
        }
 
        /**
         * Utility method to constructs a new ParseAmountError-variant ParseError
         */
-       public static ParseError parse_amount_error(UnqualifiedError a) {
+       public static ParseError parse_amount_error(org.ldk.util.UnqualifiedError a) {
                long ret = bindings.ParseError_parse_amount_error(0);
                Reference.reachabilityFence(a);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -240,7 +241,7 @@ public class ParseError extends CommonBase {
                Reference.reachabilityFence(a);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -251,7 +252,7 @@ public class ParseError extends CommonBase {
                long ret = bindings.ParseError_bad_prefix();
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -262,7 +263,7 @@ public class ParseError extends CommonBase {
                long ret = bindings.ParseError_unknown_currency();
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -273,7 +274,7 @@ public class ParseError extends CommonBase {
                long ret = bindings.ParseError_unknown_si_prefix();
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -284,7 +285,7 @@ public class ParseError extends CommonBase {
                long ret = bindings.ParseError_malformed_hrp();
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -295,7 +296,7 @@ public class ParseError extends CommonBase {
                long ret = bindings.ParseError_too_short_data_part();
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -306,19 +307,19 @@ public class ParseError extends CommonBase {
                long ret = bindings.ParseError_unexpected_end_of_tagged_fields();
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
        /**
         * Utility method to constructs a new DescriptionDecodeError-variant ParseError
         */
-       public static ParseError description_decode_error(UnqualifiedError a) {
+       public static ParseError description_decode_error(org.ldk.util.UnqualifiedError a) {
                long ret = bindings.ParseError_description_decode_error(0);
                Reference.reachabilityFence(a);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -329,7 +330,7 @@ public class ParseError extends CommonBase {
                long ret = bindings.ParseError_padding_error();
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -340,7 +341,7 @@ public class ParseError extends CommonBase {
                long ret = bindings.ParseError_integer_overflow_error();
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -351,7 +352,7 @@ public class ParseError extends CommonBase {
                long ret = bindings.ParseError_invalid_seg_wit_program_length();
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -362,7 +363,7 @@ public class ParseError extends CommonBase {
                long ret = bindings.ParseError_invalid_pub_key_hash_length();
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -373,7 +374,7 @@ public class ParseError extends CommonBase {
                long ret = bindings.ParseError_invalid_script_hash_length();
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -384,7 +385,7 @@ public class ParseError extends CommonBase {
                long ret = bindings.ParseError_invalid_recovery_id();
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -396,7 +397,7 @@ public class ParseError extends CommonBase {
                Reference.reachabilityFence(a);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
@@ -407,10 +408,25 @@ public class ParseError extends CommonBase {
                long ret = bindings.ParseError_skip();
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.ParseError ret_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
+       /**
+        * Checks if two ParseErrors contain equal inner contents.
+        * This ignores pointers and is_owned flags and looks at the values in fields.
+        */
+       public boolean eq(org.ldk.structs.ParseError b) {
+               boolean ret = bindings.ParseError_eq(this.ptr, b == null ? 0 : b.ptr);
+               Reference.reachabilityFence(this);
+               Reference.reachabilityFence(b);
+               return ret;
+       }
+
+       @Override public boolean equals(Object o) {
+               if (!(o instanceof ParseError)) return false;
+               return this.eq((ParseError)o);
+       }
        /**
         * Get the string representation of a ParseError object
         */