newMethod.freezeParamTypes();
// Build from bottom up.
JMethodCall condition = new JMethodCall(sourceInfo, null,
isJavaObjectMethod);
condition.addArg(new JParameterRef(sourceInfo, thisParam));
JMethodCall thenValue = new JMethodCall(sourceInfo, new JParameterRef(
sourceInfo, thisParam), objectMethod);
for (JParameter param : newMethod.getParams()) {
if (param != thisParam) {
thenValue.addArg(new JParameterRef(sourceInfo, param));
}
}
JMethodCall elseValue = new JMethodCall(sourceInfo, null, jsoImpl);
for (JParameter param : newMethod.getParams()) {
elseValue.addArg(new JParameterRef(sourceInfo, param));
}
JConditional conditional = new JConditional(sourceInfo, objectMethod.getType(),
condition, thenValue, elseValue);