JMethod newMethod = program.createMethod(sourceInfo, name, jsoType,
polyMethod.getType(), false, true, true, false, false);
newMethod.setSynthetic();
// Setup parameters.
JParameter thisParam = JProgram.createParameter(sourceInfo, "this$static",
program.getTypeJavaLangObject(), true, true, newMethod);
for (JParameter oldParam : polyMethod.getParams()) {
JProgram.createParameter(sourceInfo, oldParam.getName(),
oldParam.getType(), true, false, newMethod);
}
newMethod.freezeParamTypes();
newMethod.addThrownExceptions(polyMethod.getThrownExceptions());
sourceInfo.addCorrelation(sourceInfo.getCorrelator().by(newMethod));
// maybeJsoInvocation = this$static
JExpression instance = polyMethodCall.getInstance();
JLocal temp = JProgram.createLocal(sourceInfo, "maybeJsoInvocation",
thisParam.getType(), true, (JMethodBody) newMethod.getBody());
JMultiExpression multi = new JMultiExpression(sourceInfo);
// (maybeJsoInvocation = this$static, )
multi.exprs.add(JProgram.createAssignmentStmt(sourceInfo,
new JLocalRef(sourceInfo, temp),