X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FParseOrSemanticError.java;h=2873c46ac5c833de2eaa6d9418eeaa0470fbb917;hb=5cdb34f643d09f21c147c9d0b2f8888609e43429;hp=968358a505bd1260e3e7422def59eef9695f2120;hpb=9aa1eebc40df06586c7ab12f7c8eb22ebcb8b365;p=ldk-java diff --git a/src/main/java/org/ldk/structs/ParseOrSemanticError.java b/src/main/java/org/ldk/structs/ParseOrSemanticError.java index 968358a5..2873c46a 100644 --- a/src/main/java/org/ldk/structs/ParseOrSemanticError.java +++ b/src/main/java/org/ldk/structs/ParseOrSemanticError.java @@ -41,7 +41,7 @@ public class ParseOrSemanticError extends CommonBase { super(null, ptr); long parse_error = obj.parse_error; org.ldk.structs.ParseError parse_error_hu_conv = org.ldk.structs.ParseError.constr_from_ptr(parse_error); - parse_error_hu_conv.ptrs_to.add(this); + if (parse_error_hu_conv != null) { parse_error_hu_conv.ptrs_to.add(this); }; this.parse_error = parse_error_hu_conv; } } @@ -69,19 +69,20 @@ public class ParseOrSemanticError extends CommonBase { Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.ParseOrSemanticError ret_hu_conv = org.ldk.structs.ParseOrSemanticError.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(this); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }; return ret_hu_conv; } /** * Utility method to constructs a new ParseError-variant ParseOrSemanticError */ - public static ParseOrSemanticError parse_error(ParseError a) { + public static ParseOrSemanticError parse_error(org.ldk.structs.ParseError a) { long ret = bindings.ParseOrSemanticError_parse_error(a.ptr); Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.ParseOrSemanticError ret_hu_conv = org.ldk.structs.ParseOrSemanticError.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(ret_hu_conv); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(a); }; return ret_hu_conv; } @@ -93,10 +94,25 @@ public class ParseOrSemanticError extends CommonBase { Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.ParseOrSemanticError ret_hu_conv = org.ldk.structs.ParseOrSemanticError.constr_from_ptr(ret); - ret_hu_conv.ptrs_to.add(ret_hu_conv); + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }; return ret_hu_conv; } + /** + * Checks if two ParseOrSemanticErrors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ + public boolean eq(org.ldk.structs.ParseOrSemanticError b) { + boolean ret = bindings.ParseOrSemanticError_eq(this.ptr, b == null ? 0 : b.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); + return ret; + } + + @Override public boolean equals(Object o) { + if (!(o instanceof ParseOrSemanticError)) return false; + return this.eq((ParseOrSemanticError)o); + } /** * Get the string representation of a ParseOrSemanticError object */