InstrumentationServer icon indicating copy to clipboard operation
InstrumentationServer copied to clipboard

Recorded bytecode may not be correct, caching must be done as the last transformer

Open Col-E opened this issue 3 years ago • 0 comments

There is no guarantee that our transformer is the last in the chain atm. So we may not be given the most up-to-date bytecode from another transformer.

From xxDark

JVM will run all class file transformers when class is redefined, so redefineClass function should not cache class bytecode, your transformer should do that instead (you also need to keep it at the end of the list of the transformers so it is ran last) Calling retransformClasses though will probably cause all invokedynamics to bootstrap again, so it can be used to detect instrumentation, not sure what to do here tbh, but thats the only way to get actual bytecode of the class

Col-E avatar Oct 12 '22 19:10 Col-E