Properly convert 2D arrays in from_hu_conv
[ldk-java] / src / main / java / org / ldk / structs / Result_SecretKeySecpErrorZ.java
index 04bb874a9ffd740336722226a733932de96aa992..01744beefac7dc4a02f47dee14a73d8f25a7d633 100644 (file)
@@ -9,7 +9,7 @@ import java.util.Arrays;
 public class Result_SecretKeySecpErrorZ extends CommonBase {
        private Result_SecretKeySecpErrorZ(Object _dummy, long ptr) { super(ptr); }
        protected void finalize() throws Throwable {
-               bindings.CResult_SecretKeySecpErrorZ_free(ptr); super.finalize();
+               if (ptr != 0) { bindings.CResult_SecretKeySecpErrorZ_free(ptr); } super.finalize();
        }
 
        static Result_SecretKeySecpErrorZ constr_from_ptr(long ptr) {
@@ -20,18 +20,24 @@ public class Result_SecretKeySecpErrorZ extends CommonBase {
                }
        }
        public static final class Result_SecretKeySecpErrorZ_OK extends Result_SecretKeySecpErrorZ {
-               public byte[] res;
+               public final byte[] res;
                private Result_SecretKeySecpErrorZ_OK(Object _dummy, long ptr) {
                        super(_dummy, ptr);
                        this.res = bindings.LDKCResult_SecretKeySecpErrorZ_get_ok(ptr);
                }
-
+               public Result_SecretKeySecpErrorZ_OK(byte[] res) {
+                       this(null, bindings.CResult_SecretKeySecpErrorZ_ok(res));
+               }
        }
+
        public static final class Result_SecretKeySecpErrorZ_Err extends Result_SecretKeySecpErrorZ {
-               public LDKSecp256k1Error err;
+               public final LDKSecp256k1Error err;
                private Result_SecretKeySecpErrorZ_Err(Object _dummy, long ptr) {
                        super(_dummy, ptr);
                        this.err = bindings.LDKCResult_SecretKeySecpErrorZ_get_err(ptr);
                }
+               public Result_SecretKeySecpErrorZ_Err(LDKSecp256k1Error err) {
+                       this(null, bindings.CResult_SecretKeySecpErrorZ_err(err));
+               }
        }
 }