X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FNodeId.java;h=354a619f73e8298efa10042bdee89170ca45d938;hb=1854b5cebef22ace9e9e4dd191f609818df9ce08;hp=a0074a6592c3f2841cf76b9b3983dd8d3df9c0e2;hpb=5fd405f7a48aaeca779c45c88ec6b3d3d3dbf0e4;p=ldk-java diff --git a/src/main/java/org/ldk/structs/NodeId.java b/src/main/java/org/ldk/structs/NodeId.java index a0074a65..354a619f 100644 --- a/src/main/java/org/ldk/structs/NodeId.java +++ b/src/main/java/org/ldk/structs/NodeId.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; @@ -21,6 +22,7 @@ public class NodeId extends CommonBase { long clone_ptr() { long ret = bindings.NodeId_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -29,6 +31,7 @@ public class NodeId extends CommonBase { */ public NodeId clone() { long ret = bindings.NodeId_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeId(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -40,6 +43,7 @@ public class NodeId extends CommonBase { */ public static NodeId from_pubkey(byte[] pubkey) { long ret = bindings.NodeId_from_pubkey(InternalUtils.check_arr_len(pubkey, 33)); + Reference.reachabilityFence(pubkey); if (ret >= 0 && ret <= 4096) { return null; } NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeId(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -51,6 +55,7 @@ public class NodeId extends CommonBase { */ public byte[] as_slice() { byte[] ret = bindings.NodeId_as_slice(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -59,14 +64,19 @@ public class NodeId extends CommonBase { */ public long hash() { long ret = bindings.NodeId_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } + @Override public int hashCode() { + return (int)this.hash(); + } /** * Serialize the NodeId object into a byte array which can be read by NodeId_read */ public byte[] write() { byte[] ret = bindings.NodeId_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -75,6 +85,7 @@ public class NodeId extends CommonBase { */ public static Result_NodeIdDecodeErrorZ read(byte[] ser) { long ret = bindings.NodeId_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeIdDecodeErrorZ ret_hu_conv = Result_NodeIdDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv;