w.println(
"protected native Object jsniInvoke(Object target, %s<Object> params) /*-{ ",
JsArrayObject.class.getName());
w.indent();
JType returnType = method.getReturnType();
boolean hasReturnType = !"void".equals(returnType
.getQualifiedSourceName());
// Note that void is also a primitive type
boolean hasPrimitiveReturnType = hasReturnType
&& returnType.isPrimitive() != null;
if (hasReturnType) {
w.print("return ");
if (hasPrimitiveReturnType) {
// Integer.valueOf(expression);
w.print("@%s::valueOf(%s)(", returnType.isPrimitive()
.getQualifiedBoxedSourceName(), returnType
.getJNISignature());
// Implementation tested briefly, but I don't dare leave it
// enabled since we are not using it in the framework and we
// have not tests for it.