This commit is contained in:
Khaumi
2026-08-12 07:09:10 -05:00
commit 37de14c621
29 changed files with 1729 additions and 0 deletions

14
codegen/lib/java.py Normal file
View File

@@ -0,0 +1,14 @@
def java_float(value: float) -> str:
return f"{value}f"
def java_static_invoke(closure: str, option_name: str) -> str:
"""Turns a "com.example.MyMod::method" closure reference into a zero-arg
static method call expression, for APIs that need an already-computed
value (e.g. Block) rather than a functional-interface reference."""
if "::" not in closure:
raise ValueError(f"{option_name}: closure must be of the form 'pkg.Class::method', got: {closure!r}")
owner, _, method = closure.partition("::")
return f"{owner}.{method}()"