    private int {{ handle }}({{ sig_params }}) {
        try {
{% for param_unmarshal in param_unmarshal %}{{ param_unmarshal }}
{% endfor %}
{% if has_return %}            {{ return_type_str }} result = impl.{{ method_name }}({{ java_args }});
            String json = JSON.writeValueAsString(result);
            MemorySegment jsonCs = arena.allocateFrom(json);
            outResult.set(ValueLayout.ADDRESS, 0, jsonCs);
{% else %}            impl.{{ method_name }}({{ java_args }});
{% endif %}
            return 0;
        } catch (Throwable e) {
            writeError(outError, e);
            return 1;
        }
    }
