- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 833
 
Description
In a nutshell, I want to change parameter values of several methods using the same @Advice.OnMethodEnter and @Advice.OnMethodExit advice methods.
Moreover, I want the advice methods to behave differently (change different parameters), depending on which method they instrument.
        new AgentBuilder.Default()
                .type(named("com.example.MyClass"))
                .transform((builder, typeDescription, classLoader, module) ->
                        builder
                                .visit(Advice.to(MyAdvice.class).on(named("doSomething1").and(...)))
                                .visit(Advice.to(MyAdvice.class).on(named("doSomething2").and(...)))
        );
Referring to the example, I want the @Advice.OnMethodEnter and @Advice.OnMethodExit method in MyAdvice to change different parameters for doSomething1() and doSomething2(), but by using the same logic. Therefore, I would need to parameterize MyAdvice.
Since the @Advice.OnMethodEnter and @Advice.OnMethodExit methods are static, are there any ByteBuddy-way solutions for parameterizing them?
Otherwise I would need to use a global state and do the same kind of matching again which I've already done with the ElementMatchers, which bould be cumbersome.
Unfortunately, the interception api is not an option for me, since I don't want to change the class schema.
Thanks in advance!