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

How can I modify Annotation's field on method?

Open BlackBAKA opened this issue 5 months ago • 1 comments

like this ->

before:

@MyAnnotation(param1="A")
public Object m1(){
 //.......
}

after:

@MyAnnotation(param1="B")
public Object m1(){
 //.......
}

Is it possible by using bytebuddy lib ?

BlackBAKA avatar Aug 12 '25 08:08 BlackBAKA

It is, but likely it would be best to use ASM. Alternatively, you can use AnnotationRemoval and then add a new annotation. This might however be more costly than necessary for such a simple adjustment.

raphw avatar Aug 12 '25 20:08 raphw