X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FPositiveTimestamp.java;h=dd04d046844dc1bb094a00c089905cbb9c4c2c70;hb=1854b5cebef22ace9e9e4dd191f609818df9ce08;hp=2a5af0914ed7b26972027ff48981b615fbff908b;hpb=b0c50b891cbca28d3bd1d86276c132ff5221d8e4;p=ldk-java diff --git a/src/main/java/org/ldk/structs/PositiveTimestamp.java b/src/main/java/org/ldk/structs/PositiveTimestamp.java index 2a5af091..dd04d046 100644 --- a/src/main/java/org/ldk/structs/PositiveTimestamp.java +++ b/src/main/java/org/ldk/structs/PositiveTimestamp.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; /** @@ -30,16 +32,30 @@ public class PositiveTimestamp extends CommonBase { */ public boolean eq(PositiveTimestamp b) { boolean ret = bindings.PositiveTimestamp_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 PositiveTimestamp)) return false; + return this.eq((PositiveTimestamp)o); + } + long clone_ptr() { + long ret = bindings.PositiveTimestamp_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + /** * Creates a copy of the PositiveTimestamp */ public PositiveTimestamp clone() { long ret = bindings.PositiveTimestamp_clone(this.ptr); - PositiveTimestamp ret_hu_conv = new PositiveTimestamp(null, ret); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + PositiveTimestamp ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PositiveTimestamp(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -51,6 +67,8 @@ public class PositiveTimestamp extends CommonBase { */ public static Result_PositiveTimestampCreationErrorZ from_unix_timestamp(long unix_seconds) { long ret = bindings.PositiveTimestamp_from_unix_timestamp(unix_seconds); + Reference.reachabilityFence(unix_seconds); + if (ret >= 0 && ret <= 4096) { return null; } Result_PositiveTimestampCreationErrorZ ret_hu_conv = Result_PositiveTimestampCreationErrorZ.constr_from_ptr(ret); return ret_hu_conv; } @@ -62,6 +80,8 @@ public class PositiveTimestamp extends CommonBase { */ public static Result_PositiveTimestampCreationErrorZ from_system_time(long time) { long ret = bindings.PositiveTimestamp_from_system_time(time); + Reference.reachabilityFence(time); + if (ret >= 0 && ret <= 4096) { return null; } Result_PositiveTimestampCreationErrorZ ret_hu_conv = Result_PositiveTimestampCreationErrorZ.constr_from_ptr(ret); return ret_hu_conv; } @@ -71,6 +91,7 @@ public class PositiveTimestamp extends CommonBase { */ public long as_unix_timestamp() { long ret = bindings.PositiveTimestamp_as_unix_timestamp(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -79,6 +100,7 @@ public class PositiveTimestamp extends CommonBase { */ public long as_time() { long ret = bindings.PositiveTimestamp_as_time(this.ptr); + Reference.reachabilityFence(this); return ret; }