Allow trait methods to return NULL-able objects
authorMatt Corallo <git@bluematt.me>
Mon, 3 Oct 2022 20:36:31 +0000 (20:36 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 3 Oct 2022 20:38:23 +0000 (20:38 +0000)
The comment claiming this isn't supported in Java/TS is incorrect -
it works just fine with no further modifications.

genbindings.py

index 1ade1705010d1f9055fe236b0be157cb9c091146..fd09ba2a264c91fd5c71555242b51782a9b6cf0f 100755 (executable)
@@ -756,9 +756,8 @@ with open(sys.argv[1]) as in_h, open(f"{sys.argv[2]}/bindings{consts.file_ext}",
                 else:
                     (nullable_params, ret_nullable) = doc_to_params_ret_nullable(fn_docs)
                     if ret_nullable:
-                        assert False # This isn't yet handled on the Java side
-                        ret_ty_info.nullable = True
                         ret_ty_info = type_mapping_generator.map_nullable_type(fn_line.group(2).strip() + " ret", True, None, False, False)
+                        ret_ty_info.nullable = True
                     else:
                         ret_ty_info = type_mapping_generator.map_type(fn_line.group(2).strip() + " ret", True, None, False, False)
                     is_const = fn_line.group(4) is not None