use of org.apache.bcel.generic.EmptyVisitor in project jop by jop-devel.
the class ConstantPoolRebuilder method updateMethodGen.
public void updateMethodGen(MethodInfo methodInfo, MethodGen methodGen) {
methodGen.setConstantPool(newPool);
if (methodInfo.hasCode()) {
// update all instructions
InstructionList il = methodInfo.getCode().getInstructionList();
class InstructionVisitor extends EmptyVisitor {
@Override
public void visitCPInstruction(CPInstruction obj) {
obj.setIndex(mapIndex(obj.getIndex()));
}
}
InstructionVisitor iv = new InstructionVisitor();
for (InstructionHandle ih : il.getInstructionHandles()) {
ih.getInstruction().accept(iv);
}
updateAttributes(methodInfo, methodGen.getCodeAttributes());
}
updateAttributes(methodInfo, methodGen.getAttributes());
}
Aggregations