I've created the following agent which supposedly rebases every class and transforms every method, using the ByteBuddy example LogInterceptor
(which just prints the name of the method being called):
public static void main(String[] args) {
ByteBuddyAgent.installOnOpenJDK();
new AgentBuilder.Default()
.rebase(ElementMatchers.any())
.transform((builder, typeDescription) -> builder
.method(ElementMatchers.any())
.intercept(
MethodDelegation
.to(LogInterceptor.class)
.andThen(SuperMethodCall.INSTANCE)
)
)
.installOnByteBuddyAgent();
After doing this I proceed to call my code, which for example does:
new JFXPanel()
...to initialize JavaFX. However, I don't see my interceptor printing any methods inside JavaFX. But what is worse, I don't see ByteBuddy printing any methods on some of my classes either, although it does in some of them completely at random (or so it seems).
Isn't my agent supposed to capture every single method for every single class? This is obviously not what I want to do, but as a way of debugging why the methods I'm interested in are not being instrumented.