Use explicit paths for function arguments in Java
authorMatt Corallo <git@bluematt.me>
Sat, 7 Aug 2021 22:24:22 +0000 (22:24 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 9 Aug 2021 05:53:31 +0000 (05:53 +0000)
When we have an enum with a variant named the same as a struct we
need to specify a full concrete path when referring to it. The
simplest approach is to just use full concrete paths for all
function arguments, which we do here.

java_strings.py

index ed9381c4f42646e6057634408244ae8d4512692f..3482dfb9b63b3e011957c581ce273325b31f69ee 100644 (file)
@@ -1173,7 +1173,10 @@ import javax.annotation.Nullable;
                     else:
                         if arg.nullable:
                             out_java_struct += "@Nullable "
-                        out_java_struct += (arg.java_hu_ty + " " + arg.arg_name)
+                        ty_string = arg.java_hu_ty
+                        if arg.java_fn_ty_arg[0] == "L" and arg.java_fn_ty_arg[len(arg.java_fn_ty_arg) - 1] == ";":
+                            ty_string = arg.java_fn_ty_arg.strip("L;").replace("/", ".")
+                        out_java_struct += ty_string + " " + arg.arg_name
         out_java += (");\n")
         out_c += (") {\n")
         if out_java_struct is not None: