java:static
(java:static "fully.qualified.ClassName" "methodName" args...)
Invokes a static method, choosing the overload whose parameters best match the
arguments, and returns the marshalled result. Only the class's static methods
are candidates: (java:static "java.lang.String" "length") finds no method.
Part of the
JVM-only java interop
package — available on the interpreter and in JVM-compiled classes, not on the
WASM backend.
See the Java interop guide.
Math.max is overloaded for int/long/float/double; the integer
arguments select the int overload, so the result is the integer 7.
The method name may carry the parameter types, which picks the overload directly:
"max(long,long)", or "max(long,_)" with _ left to the cost rule. A call is resolved
once, before it runs: to one method when its argument kinds are known from the text,
otherwise to the overloads it chooses among by the kinds its arguments have when it runs
(the guide's Resolving calls before they
run).
Ending the call in :java-false, after the arguments (before or after :functional),
answers Java's false as |false| rather than nil (the guide's Java's false
back):
Ending it in :octets answers a byte[] as an (unsigned-byte 8) vector of its octets, and
hands a function the call converts one the same way (the guide's Octets
back); a :bytes view hands
one to Java:
Ending it in :through and a function has Java call a function the call converts through
that function (the guide's Calling functions through another).