How to remove an annotation easily
Hi,
I found the following code:
new ByteBuddy() .redefine(clazz) .visit(new MemberRemoval().

but no stripAnnotation? Is there any plans for it? I would make my life easier :-)
//mike
You are right, this would be a useful feature. I can see if I can add it.
Looking at it, I now remember why this is not an option. Annotations are visited by their descriptor and only then it is possible to abort the writing, before paring the entire annotation. Therefore, Byte Buddy normally shortwires annotations, for efficiency reasons.
What you need to do is to configure Byte Buddy to replay annotations: new ByteBuddy().with(AnnotationRetention.DISABLED), and then you can register a Transformer where you change fields or methods to contain certain annotations or not. Then these annotations are written as is.