X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FRawInvoice.java;h=3bdb47c14121f7f36a1f07afdc76d47fd34f5d39;hb=ff3dacec3be60f870d81f6df11bd9fff92aa6047;hp=1a6a07d0f6f259c0454465fce433550db0b1fff8;hpb=32692e00046b7ec16b6a2e20bd54800b2b48d4c0;p=ldk-java diff --git a/src/main/java/org/ldk/structs/RawInvoice.java b/src/main/java/org/ldk/structs/RawInvoice.java index 1a6a07d0..3bdb47c1 100644 --- a/src/main/java/org/ldk/structs/RawInvoice.java +++ b/src/main/java/org/ldk/structs/RawInvoice.java @@ -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; @@ -28,8 +29,9 @@ public class RawInvoice extends CommonBase { */ public RawDataPart get_data() { long ret = bindings.RawInvoice_get_data(this.ptr); - if (ret >= 0 && ret < 1024) { return null; } - RawDataPart ret_hu_conv = new RawDataPart(null, ret); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + RawDataPart ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RawDataPart(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -39,6 +41,8 @@ public class RawInvoice extends CommonBase { */ public void set_data(RawDataPart val) { bindings.RawInvoice_set_data(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -48,17 +52,30 @@ public class RawInvoice extends CommonBase { */ public boolean eq(RawInvoice b) { boolean ret = bindings.RawInvoice_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); 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; + } + /** * Creates a copy of the RawInvoice */ public RawInvoice clone() { long ret = bindings.RawInvoice_clone(this.ptr); - if (ret >= 0 && ret < 1024) { return null; } - RawInvoice ret_hu_conv = new RawInvoice(null, ret); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + RawInvoice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RawInvoice(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -68,6 +85,7 @@ public class RawInvoice extends CommonBase { */ public byte[] hash() { byte[] ret = bindings.RawInvoice_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -77,8 +95,9 @@ public class RawInvoice extends CommonBase { @Nullable public Sha256 payment_hash() { long ret = bindings.RawInvoice_payment_hash(this.ptr); - if (ret >= 0 && ret < 1024) { return null; } - Sha256 ret_hu_conv = new Sha256(null, ret); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Sha256 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Sha256(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -89,8 +108,9 @@ public class RawInvoice extends CommonBase { @Nullable public Description description() { long ret = bindings.RawInvoice_description(this.ptr); - if (ret >= 0 && ret < 1024) { return null; } - Description ret_hu_conv = new Description(null, ret); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Description ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Description(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -101,8 +121,9 @@ public class RawInvoice extends CommonBase { @Nullable public PayeePubKey payee_pub_key() { long ret = bindings.RawInvoice_payee_pub_key(this.ptr); - if (ret >= 0 && ret < 1024) { return null; } - PayeePubKey ret_hu_conv = new PayeePubKey(null, ret); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + PayeePubKey ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PayeePubKey(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -113,8 +134,9 @@ public class RawInvoice extends CommonBase { @Nullable public Sha256 description_hash() { long ret = bindings.RawInvoice_description_hash(this.ptr); - if (ret >= 0 && ret < 1024) { return null; } - Sha256 ret_hu_conv = new Sha256(null, ret); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Sha256 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Sha256(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -125,8 +147,9 @@ public class RawInvoice extends CommonBase { @Nullable public ExpiryTime expiry_time() { long ret = bindings.RawInvoice_expiry_time(this.ptr); - if (ret >= 0 && ret < 1024) { return null; } - ExpiryTime ret_hu_conv = new ExpiryTime(null, ret); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + ExpiryTime ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ExpiryTime(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -137,8 +160,9 @@ public class RawInvoice extends CommonBase { @Nullable public MinFinalCltvExpiry min_final_cltv_expiry() { long ret = bindings.RawInvoice_min_final_cltv_expiry(this.ptr); - if (ret >= 0 && ret < 1024) { return null; } - MinFinalCltvExpiry ret_hu_conv = new MinFinalCltvExpiry(null, ret); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + MinFinalCltvExpiry ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new MinFinalCltvExpiry(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -149,6 +173,7 @@ public class RawInvoice extends CommonBase { @Nullable public byte[] payment_secret() { byte[] ret = bindings.RawInvoice_payment_secret(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -158,18 +183,21 @@ public class RawInvoice extends CommonBase { @Nullable public InvoiceFeatures features() { long ret = bindings.RawInvoice_features(this.ptr); - if (ret >= 0 && ret < 1024) { return null; } - InvoiceFeatures ret_hu_conv = new InvoiceFeatures(null, ret); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InvoiceFeatures(null, ret); } 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); + PrivateRoute ret_conv_14_hu_conv = null; if (ret_conv_14 < 0 || ret_conv_14 > 4096) { ret_conv_14_hu_conv = new PrivateRoute(null, ret_conv_14); } ret_conv_14_hu_conv.ptrs_to.add(this); ret_conv_14_arr[o] = ret_conv_14_hu_conv; } @@ -178,14 +206,16 @@ public class RawInvoice extends CommonBase { public Option_u64Z amount_pico_btc() { long ret = bindings.RawInvoice_amount_pico_btc(this.ptr); - if (ret >= 0 && ret < 1024) { return null; } - Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); + 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); 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; }