ifbody.appendNotNullValue(paramType, field1, field2);
}
void appendNotNullValue(AbstractJType type, IJExpression value1, IJExpression value2) {
if (type.isArray()) {
JInvocation invocation = types._Math.staticInvoke("min");
invocation.arg(value1.ref("length"));
invocation.arg(value2.ref("length"));
JVar length = body.decl(types._int, nameSource.get("length"), invocation);
VariableNameSource localNames = nameSource.forBlock();
JForLoop _for = body._for();
JVar i = _for.init(types._int, localNames.get("i"), JExpr.lit(0));
_for.test(i.lt(length));
_for.update(i.incr());
Body forBody = new Body(resultVariable, _for.body(), localNames);
if (type.elementType().isReference())
forBody.appendNullableValue(type.elementType(), value1.component(i), value2.component(i));
else
forBody.appendNotNullValue(type.elementType(), value1.component(i), value2.component(i));
appendNotNullValue(types._int, value1.ref("length"), value2.ref("length"));
} else if (type.isPrimitive()) {
IJExpression condition = JOp.cond(value1.lt(value2), JExpr.lit(-1),
JOp.cond(value1.eq(value2), JExpr.lit(0), JExpr.lit(1)));
body.assign(resultVariable, condition);
JConditional _if = body._if(resultVariable.ne(JExpr.lit(0)));
_if._then()._return(resultVariable);
} else {
JInvocation invocation = value1.invoke("compareTo");
invocation.arg(value2);
body.assign(resultVariable, invocation);
JConditional _if = body._if(resultVariable.ne(JExpr.lit(0)));
_if._then()._return(resultVariable);
}
}