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