enclosingType, oldReturnType, false, true, true, x.isPrivate());
// Setup all params and locals; map from the old method to the new method
JParameter thisParam = program.createParameter(null,
"this$static".toCharArray(), enclosingType, true, newMethod);
Map/* <JVariable, JVariable> */varMap = new IdentityHashMap();
for (int i = 0; i < x.params.size(); ++i) {
JParameter oldVar = (JParameter) x.params.get(i);
JParameter newVar = program.createParameter(oldVar.getSourceInfo(),
oldVar.getName().toCharArray(), oldVar.getType(), oldVar.isFinal(),
newMethod);
varMap.put(oldVar, newVar);
}
newMethod.freezeParamTypes();
// Copy all locals over to the new method
for (int i = 0; i < x.locals.size(); ++i) {
JLocal oldVar = (JLocal) x.locals.get(i);
JLocal newVar = program.createLocal(oldVar.getSourceInfo(),
oldVar.getName().toCharArray(), oldVar.getType(), oldVar.isFinal(),
newMethod);
varMap.put(oldVar, newVar);
}
x.locals.clear();
// Move the body of the instance method to the static method
newMethod.body.statements.addAll(x.body.statements);