I am writing a Java instrumentation program that uses the built-in Instrumentation API with Javassist (v3.26.0-GA) to intercept all the method calls in the target program. Also, I have implemented a REST API service inside this program using Java Spark to send requests for starting/stopping instrumentation by…
Tag: javassist
When using javassist anonymous inner class how to access instance variables of outer class?
Below is the anonymous inner class definition: Below is the running example: I want to redefine the body of the run method, but I cannot access the instance variables of the outer class in the body Answer According to the manual, Javassist does not support inner class generation, but claims to support to read…
Java instanceOf analogue in Javassist
I’m working on a plugin for Gradle in android project. I use Transformation Api for manipulate with byte code across compilation and for this purpose I choosen Javassist. My question related to this library. Before manipulate byte code I need determine which type has this class. For example, if some ctC…