Javassist's CtMethod.insertAt(line,src) instruments code at the wrong bytecode position
问题 My goal is to insert a little bit of instrumentation code at the beginning of each basic block of code. It seems like a fairly simple task with Javaassist's ControlFlow.Block and CtMethod.insertAt(). Here's the relevant chunk of code so far (it's located in the transform function): ControlFlow flow=new ControlFlow(m); //m is the CtMethod currently being instrumented Block[] blockArray=flow.basicBlocks(); for(Block thisbb : blockArray){ //Dynamically Update Method Statistics String blockUpdate