Fully-Qualify Paths in some contexts instead of assuming enums
[ldk-java] / gen_type_mapping.py
index d3d00d28a172d46af1641034e1040609aec0a378..9cee9ab454773332293ae6711bf8b5b6e5e2159f 100644 (file)
@@ -439,10 +439,12 @@ class TypeMappingGenerator:
                     if from_hu_conv is None:
                         from_hu_conv = (self.consts.get_ptr(ty_info.var_name), "")
                     from_hu_conv = (from_hu_conv[0], to_hu_conv_sfx)
+                    fully_qualified_ty = self.consts.fully_qualified_hu_ty_path(ty_info)
+                    to_hu_call = fully_qualified_ty + ".constr_from_ptr(" + ty_info.var_name + ")"
                     return ConvInfo(ty_info = ty_info, arg_name = ty_info.var_name,
                         arg_conv = base_conv, arg_conv_name = ty_info.var_name + "_conv", arg_conv_cleanup = None,
                         ret_conv = ret_conv, ret_conv_name = ty_info.var_name + "_ref",
-                        to_hu_conv = self.consts.var_decl_statement(ty_info.java_hu_ty, ty_info.var_name + "_hu_conv", ty_info.java_hu_ty + ".constr_from_ptr(" + ty_info.var_name + ")") + ";\n" + self.consts.add_ref(ty_info.var_name + "_hu_conv", "this") + ";",
+                        to_hu_conv = self.consts.var_decl_statement(fully_qualified_ty, ty_info.var_name + "_hu_conv", to_hu_call) + ";\n" + self.consts.add_ref(ty_info.var_name + "_hu_conv", "this") + ";",
                         to_hu_conv_name = ty_info.var_name + "_hu_conv", from_hu_conv = from_hu_conv)
                 if ty_info.rust_obj in self.result_types:
                     if holds_ref: