]> git.bitcoin.ninja Git - ldk-java/commitdiff
Properly convert 2D arrays in from_hu_conv
authorMatt Corallo <git@bluematt.me>
Fri, 12 Feb 2021 01:57:38 +0000 (20:57 -0500)
committerMatt Corallo <git@bluematt.me>
Fri, 5 Mar 2021 19:40:22 +0000 (14:40 -0500)
gen_type_mapping.py

index 3868daebda47112766907d7053c6ac579c1fdd1b..dfb2b57edddd69b16d0489372ae0d494e2ab701b 100644 (file)
@@ -165,7 +165,7 @@ class TypeMappingGenerator:
                     elif subty.java_ty == "long":
                         from_hu_conv = ("Arrays.stream(" + arr_name + ").map(" + conv_name + " -> " + subty.from_hu_conv[0] + ").toArray()", "/* TODO 2 " + subty.java_hu_ty + "  */")
                     else:
-                        from_hu_conv = ("(" + ty_info.java_ty + ")Arrays.stream(" + arr_name + ").map(" + conv_name + " -> " + subty.from_hu_conv[0] + ").toArray()", "/* TODO 2 " + subty.java_hu_ty + "  */")
+                        from_hu_conv = ("Arrays.stream(" + arr_name + ").map(" + conv_name + " -> " + subty.from_hu_conv[0] + ").toArray(" + ty_info.java_ty + "::new)", "/* TODO 2 " + subty.java_hu_ty + "  */")
 
                 return ConvInfo(ty_info = ty_info, arg_name = ty_info.var_name,
                     arg_conv = arg_conv, arg_conv_name = arg_conv_name, arg_conv_cleanup = arg_conv_cleanup,