Closed auermich93 closed 3 years ago
Modifying the method invalidates existing instructions (sorry, I know - not documented :).
I think this should work:
MutableMethodImplementation mutableMethodImplementation = new MutableMethodImplementation(methodImplementation);
List<BuilderInstruction> builderInstructions = mutableMethodImplementation.getInstructions();
LOGGER.debug("Index: " + builderInstructions.get(0).getLocation().getIndex());
// shift original first instruction by one position
mutableMethodImplementation.addInstruction(0, someInstruction);
LOGGER.debug("Index: " + builderInstructions.get(0).getLocation().getIndex());
I know that this works, but I intended to keep a list of instrumentation points, where an instrumentation point encapsulates an index and a builder instruction. The index refers to the instruction index of the unmodified method and the builder instruction was meant to keep the updated location. I have a working solution but an up-to-date builder instruction would simplify things.
Hi,
wouldn't it be desired if the method location of a builder instruction would be updated, e.g. consider the following use case:
I know that the MutableMethodImplementation class doesn't directly maintain a list of instructions.