byte-buddy icon indicating copy to clipboard operation
byte-buddy copied to clipboard

Allow to bind modifiers using the @Origin annotation.

Open jafarre-bi opened this issue 2 months ago • 1 comments

Hello, In the plugin I'm developing, I need to use method modifiers within the advice. As a first approach, I bound @Origin Method, but this requires reflectively retrieving the Method every time, or alternatively caching it. As I only needed the modifiers, I've created a custom binding that allows me to use the @Origin annotation on an int parameter and map the modifiers as a constant. It boils down to adding a new if condition to the ForOrigin.Factory.make method. This makes sense as a general-purpose functionality of the annotation. When rendering it into a String, a new flag could be used to render the modifiers as they appear in the code, following the Java order convention. What do you think?

jafarre-bi avatar Oct 26 '25 21:10 jafarre-bi

Good point. It is already supported in the delegation, I just added the support to the other ones.

raphw avatar Oct 26 '25 21:10 raphw