[Java] Update auto-generated Java bindings
[ldk-java] / src / main / java / org / ldk / structs / PaymentError.java
index ca806da1bbbcd9fd94f0a8fcb37521733654a6aa..a6c2abce61a497a085eed33c35e405d49db6771d 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;
 
 
@@ -23,50 +24,47 @@ public class PaymentError extends CommonBase {
                if (raw_val.getClass() == bindings.LDKPaymentError.Invoice.class) {
                        return new Invoice(ptr, (bindings.LDKPaymentError.Invoice)raw_val);
                }
-               if (raw_val.getClass() == bindings.LDKPaymentError.Routing.class) {
-                       return new Routing(ptr, (bindings.LDKPaymentError.Routing)raw_val);
-               }
                if (raw_val.getClass() == bindings.LDKPaymentError.Sending.class) {
                        return new Sending(ptr, (bindings.LDKPaymentError.Sending)raw_val);
                }
                assert false; return null; // Unreachable without extending the (internal) bindings interface
        }
 
+       /**
+        * An error resulting from the provided [`Invoice`] or payment hash.
+        */
        public final static class Invoice extends PaymentError {
-               public final String invoice;
+               public final java.lang.String invoice;
                private Invoice(long ptr, bindings.LDKPaymentError.Invoice obj) {
                        super(null, ptr);
                        this.invoice = obj.invoice;
                }
        }
-       public final static class Routing extends PaymentError {
-               public final LightningError routing;
-               private Routing(long ptr, bindings.LDKPaymentError.Routing obj) {
-                       super(null, ptr);
-                       long routing = obj.routing;
-                       LightningError routing_hu_conv = null; if (routing < 0 || routing > 4096) { routing_hu_conv = new LightningError(null, routing); }
-                       routing_hu_conv.ptrs_to.add(this);
-                       this.routing = routing_hu_conv;
-               }
-       }
+       /**
+        * An error occurring when sending a payment.
+        */
        public final static class Sending extends PaymentError {
-               public final PaymentSendFailure sending;
+               public final org.ldk.enums.RetryableSendFailure sending;
                private Sending(long ptr, bindings.LDKPaymentError.Sending obj) {
                        super(null, ptr);
-                       long sending = obj.sending;
-                       PaymentSendFailure sending_hu_conv = PaymentSendFailure.constr_from_ptr(sending);
-                       sending_hu_conv.ptrs_to.add(this);
-                       this.sending = sending_hu_conv;
+                       this.sending = obj.sending;
                }
        }
+       long clone_ptr() {
+               long ret = bindings.PaymentError_clone_ptr(this.ptr);
+               Reference.reachabilityFence(this);
+               return ret;
+       }
+
        /**
         * Creates a copy of the PaymentError
         */
        public PaymentError clone() {
                long ret = bindings.PaymentError_clone(this.ptr);
+               Reference.reachabilityFence(this);
                if (ret >= 0 && ret <= 4096) { return null; }
-               PaymentError ret_hu_conv = PaymentError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(this);
+               org.ldk.structs.PaymentError ret_hu_conv = org.ldk.structs.PaymentError.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
                return ret_hu_conv;
        }
 
@@ -75,31 +73,22 @@ public class PaymentError extends CommonBase {
         */
        public static PaymentError invoice(java.lang.String a) {
                long ret = bindings.PaymentError_invoice(a);
+               Reference.reachabilityFence(a);
                if (ret >= 0 && ret <= 4096) { return null; }
-               PaymentError ret_hu_conv = PaymentError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
-               return ret_hu_conv;
-       }
-
-       /**
-        * Utility method to constructs a new Routing-variant PaymentError
-        */
-       public static PaymentError routing(LightningError a) {
-               long ret = bindings.PaymentError_routing(a == null ? 0 : a.ptr & ~1);
-               if (ret >= 0 && ret <= 4096) { return null; }
-               PaymentError ret_hu_conv = PaymentError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               org.ldk.structs.PaymentError ret_hu_conv = org.ldk.structs.PaymentError.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }
 
        /**
         * Utility method to constructs a new Sending-variant PaymentError
         */
-       public static PaymentError sending(PaymentSendFailure a) {
-               long ret = bindings.PaymentError_sending(a.ptr);
+       public static PaymentError sending(org.ldk.enums.RetryableSendFailure a) {
+               long ret = bindings.PaymentError_sending(a);
+               Reference.reachabilityFence(a);
                if (ret >= 0 && ret <= 4096) { return null; }
-               PaymentError ret_hu_conv = PaymentError.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               org.ldk.structs.PaymentError ret_hu_conv = org.ldk.structs.PaymentError.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
                return ret_hu_conv;
        }