Fix write method generation w/ upstream changes
[ldk-java] / src / main / java / org / ldk / structs / Ping.java
index e0e1b3d541ac1cddaf789d5a36d77c699540a9eb..25e970f76e9a463d7c1674560fb6ea199b739039 100644 (file)
@@ -2,48 +2,58 @@ package org.ldk.structs;
 
 import org.ldk.impl.bindings;
 import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
 
+@SuppressWarnings("unchecked") // We correctly assign various generic arrays
 public class Ping extends CommonBase {
        Ping(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.Ping_free(ptr); super.finalize();
+               super.finalize();
+               if (ptr != 0) { bindings.Ping_free(ptr); }
        }
 
-       public Ping(Ping orig) {
-               super(bindings.Ping_clone(orig == null ? 0 : orig.ptr & ~1));
-               this.ptrs_to.add(orig);
+       public static Ping constructor_clone(Ping orig) {
+               long ret = bindings.Ping_clone(orig == null ? 0 : orig.ptr & ~1);
+               Ping ret_hu_conv = new Ping(null, ret);
+               ret_hu_conv.ptrs_to.add(orig);
+               return ret_hu_conv;
        }
 
-       public short get_ponglen(Ping this_ptr) {
-               short ret = bindings.Ping_get_ponglen(this_ptr == null ? 0 : this_ptr.ptr & ~1);
-               this.ptrs_to.add(this_ptr);
+       public short get_ponglen() {
+               short ret = bindings.Ping_get_ponglen(this.ptr);
                return ret;
        }
 
-       public void set_ponglen(Ping this_ptr, short val) {
-               bindings.Ping_set_ponglen(this_ptr == null ? 0 : this_ptr.ptr & ~1, val);
-               this.ptrs_to.add(this_ptr);
+       public void set_ponglen(short val) {
+               bindings.Ping_set_ponglen(this.ptr, val);
        }
 
-       public short get_byteslen(Ping this_ptr) {
-               short ret = bindings.Ping_get_byteslen(this_ptr == null ? 0 : this_ptr.ptr & ~1);
-               this.ptrs_to.add(this_ptr);
+       public short get_byteslen() {
+               short ret = bindings.Ping_get_byteslen(this.ptr);
                return ret;
        }
 
-       public void set_byteslen(Ping this_ptr, short val) {
-               bindings.Ping_set_byteslen(this_ptr == null ? 0 : this_ptr.ptr & ~1, val);
-               this.ptrs_to.add(this_ptr);
+       public void set_byteslen(short val) {
+               bindings.Ping_set_byteslen(this.ptr, val);
        }
 
-       public Ping(short ponglen_arg, short byteslen_arg) {
-               super(bindings.Ping_new(ponglen_arg, byteslen_arg));
+       public static Ping constructor_new(short ponglen_arg, short byteslen_arg) {
+               long ret = bindings.Ping_new(ponglen_arg, byteslen_arg);
+               Ping ret_hu_conv = new Ping(null, ret);
+               return ret_hu_conv;
        }
 
-       // Skipped Ping_write
-       public Ping(byte[] ser) {
-               super(bindings.Ping_read(ser));
+       public byte[] write() {
+               byte[] ret = bindings.Ping_write(this.ptr);
+               return ret;
+       }
+
+       public static Ping constructor_read(byte[] ser) {
+               long ret = bindings.Ping_read(ser);
+               Ping ret_hu_conv = new Ping(null, ret);
+               return ret_hu_conv;
        }
 
 }