X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FRawInvoice.java;h=fea24f2d06055789d69bd1d605c166ecd2aca399;hb=f385eff0dd0aa61fbf21ae946c424f4a6a26de04;hp=a63dc0b349a4a9ec608f7423c512cea5b39ab32a;hpb=b0c50b891cbca28d3bd1d86276c132ff5221d8e4;p=ldk-java diff --git a/src/main/java/org/ldk/structs/RawInvoice.java b/src/main/java/org/ldk/structs/RawInvoice.java index a63dc0b3..fea24f2d 100644 --- a/src/main/java/org/ldk/structs/RawInvoice.java +++ b/src/main/java/org/ldk/structs/RawInvoice.java @@ -4,6 +4,8 @@ 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; /** @@ -27,8 +29,10 @@ public class RawInvoice extends CommonBase { */ public RawDataPart get_data() { long ret = bindings.RawInvoice_get_data(this.ptr); - RawDataPart ret_hu_conv = new RawDataPart(null, ret); - ret_hu_conv.ptrs_to.add(this); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.RawDataPart ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RawDataPart(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -36,8 +40,10 @@ public class RawInvoice extends CommonBase { * data part */ public void set_data(RawDataPart val) { - bindings.RawInvoice_set_data(this.ptr, val == null ? 0 : val.ptr & ~1); - this.ptrs_to.add(val); + bindings.RawInvoice_set_data(this.ptr, val == null ? 0 : val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + if (this != null) { this.ptrs_to.add(val); }; } /** @@ -46,8 +52,20 @@ public class RawInvoice extends CommonBase { * Two objects with NULL inner values will be considered "equal" here. */ public boolean eq(RawInvoice b) { - boolean ret = bindings.RawInvoice_eq(this.ptr, b == null ? 0 : b.ptr & ~1); - this.ptrs_to.add(b); + boolean ret = bindings.RawInvoice_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 RawInvoice)) return false; + return this.eq((RawInvoice)o); + } + long clone_ptr() { + long ret = bindings.RawInvoice_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -56,8 +74,10 @@ public class RawInvoice extends CommonBase { */ public RawInvoice clone() { long ret = bindings.RawInvoice_clone(this.ptr); - RawInvoice ret_hu_conv = new RawInvoice(null, ret); - ret_hu_conv.ptrs_to.add(this); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.RawInvoice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RawInvoice(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } @@ -66,70 +86,120 @@ public class RawInvoice extends CommonBase { */ public byte[] hash() { byte[] ret = bindings.RawInvoice_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } + /** + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable public Sha256 payment_hash() { long ret = bindings.RawInvoice_payment_hash(this.ptr); - Sha256 ret_hu_conv = new Sha256(null, ret); - ret_hu_conv.ptrs_to.add(this); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Sha256 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Sha256(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } + /** + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable public Description description() { long ret = bindings.RawInvoice_description(this.ptr); - Description ret_hu_conv = new Description(null, ret); - ret_hu_conv.ptrs_to.add(this); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Description ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Description(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } + /** + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable public PayeePubKey payee_pub_key() { long ret = bindings.RawInvoice_payee_pub_key(this.ptr); - PayeePubKey ret_hu_conv = new PayeePubKey(null, ret); - ret_hu_conv.ptrs_to.add(this); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.PayeePubKey ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PayeePubKey(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } + /** + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable public Sha256 description_hash() { long ret = bindings.RawInvoice_description_hash(this.ptr); - Sha256 ret_hu_conv = new Sha256(null, ret); - ret_hu_conv.ptrs_to.add(this); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Sha256 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Sha256(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } + /** + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable public ExpiryTime expiry_time() { long ret = bindings.RawInvoice_expiry_time(this.ptr); - ExpiryTime ret_hu_conv = new ExpiryTime(null, ret); - ret_hu_conv.ptrs_to.add(this); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.ExpiryTime ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ExpiryTime(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } + /** + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable public MinFinalCltvExpiry min_final_cltv_expiry() { long ret = bindings.RawInvoice_min_final_cltv_expiry(this.ptr); - MinFinalCltvExpiry ret_hu_conv = new MinFinalCltvExpiry(null, ret); - ret_hu_conv.ptrs_to.add(this); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.MinFinalCltvExpiry ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.MinFinalCltvExpiry(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } + /** + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable public byte[] payment_secret() { byte[] ret = bindings.RawInvoice_payment_secret(this.ptr); + Reference.reachabilityFence(this); return ret; } + /** + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable public InvoiceFeatures features() { long ret = bindings.RawInvoice_features(this.ptr); - InvoiceFeatures ret_hu_conv = new InvoiceFeatures(null, ret); - ret_hu_conv.ptrs_to.add(this); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InvoiceFeatures(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } public PrivateRoute[] private_routes() { long[] ret = bindings.RawInvoice_private_routes(this.ptr); - PrivateRoute[] ret_conv_14_arr = new PrivateRoute[ret.length]; - for (int o = 0; o < ret.length; o++) { + Reference.reachabilityFence(this); + int ret_conv_14_len = ret.length; + PrivateRoute[] ret_conv_14_arr = new PrivateRoute[ret_conv_14_len]; + for (int o = 0; o < ret_conv_14_len; o++) { long ret_conv_14 = ret[o]; - PrivateRoute ret_conv_14_hu_conv = new PrivateRoute(null, ret_conv_14); - ret_conv_14_hu_conv.ptrs_to.add(this); + org.ldk.structs.PrivateRoute ret_conv_14_hu_conv = null; if (ret_conv_14 < 0 || ret_conv_14 > 4096) { ret_conv_14_hu_conv = new org.ldk.structs.PrivateRoute(null, ret_conv_14); } + if (ret_conv_14_hu_conv != null) { ret_conv_14_hu_conv.ptrs_to.add(this); }; ret_conv_14_arr[o] = ret_conv_14_hu_conv; } return ret_conv_14_arr; @@ -137,13 +207,16 @@ public class RawInvoice extends CommonBase { public Option_u64Z amount_pico_btc() { long ret = bindings.RawInvoice_amount_pico_btc(this.ptr); - Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(this); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } public Currency currency() { Currency ret = bindings.RawInvoice_currency(this.ptr); + Reference.reachabilityFence(this); return ret; }