# Generate a static call on a method definition (no receiver needed).
fun static_call(mmethoddef: MMethodDef, arguments: Array[RuntimeVariable]): nullable RuntimeVariable do
var res: nullable RuntimeVariable
var ret = mmethoddef.msignature.as(not null).return_mtype
if ret == null then
res = null
else
ret = ret.resolve_for(mmethoddef.mclassdef.bound_mtype, mmethoddef.mclassdef.bound_mtype, mmethoddef.mclassdef.mmodule, true)
res = self.new_var(ret)
end
# Autobox arguments
adapt_signature(mmethoddef, arguments)
var rt_name = mmethoddef.rt_name
if res == null then
add("{rt_name}.get{rt_name}().exec(new RTVal[]\{{arguments.join(",")}\});")
return null
end
var ress = new_expr("{rt_name}.get{rt_name}().exec(new RTVal[]\{{arguments.join(",")}\});", compiler.mainmodule.object_type)
assign(res, ress)
return res
end
src/compiler/java_compiler.nit:541,2--563,4