title: Add method annotation at runtime with Byte Buddy
body: <p>I've been searching for the answer to "how to add an annotation to the method at runtime" for several days already and found this awesome tool called Byte Buddy, played with it, but still cannot make it work as I need to. I'm sure it must be able to do that from this question <a href="https://stackoverflow.com/questions/34857309/can-byte-buddy-create-fields-and-method-annotations-at-runtime">Can Byte Buddy create fields and method annotations at runtime?</a></p>
  
  <p>Having this class:</p>
  
  <pre><code>public class ClassThatNeedsToBeAnnotated {
    public void method(int arg1, String arg2) {
      // code that we don't want to touch at all, leave it as is
      System.out.println("Called method with arguments " + arg1 + " " + arg2);
    }
  
    public void method() {
      System.out.println("Called method without arguments");
    }
  }
  </code></pre>
  
  <p>and this code:</p>
  
  <pre><code> public class MainClass {
        public static void main(String[] args) {
          ByteBuddyAgent.install();
  
          AnnotationDescription description = AnnotationDescription.Builder.ofType(MyClassAnnotation.class)
              .define("value", "new")
              .build();
  
          new ByteBuddy()
              .redefine(ClassThatNeedsToBeAnnotated.class)
              .annotateType(description)
              .make()
              .load(ClassThatNeedsToBeAnnotated.class.getClassLoader(), ClassReloadingStrategy.fromInstalledAgent());
  
        }
  }
  </code></pre>
  
  <p>It is easy to add an annotation to the <strong>class</strong>. 
  But for the <strong>method</strong>, it seems to be not possible without changing the method implementation. </p>
  
  <pre><code>Method existingMethod = ClassThatNeedsToBeAnnotated.class.getDeclaredMethods()[0];
  AnnotationDescription annotationDescription = AnnotationDescription.Builder.ofType(MyMethodAnnotation.class)
      .build();
  new ByteBuddy()
      .redefine(ClassThatNeedsToBeAnnotated.class)
      .annotateType(description)
      .method(ElementMatchers.anyOf(existingMethod))
      // here I don't want to intercept method, I want to leave the method code untouched. How to do that?
      .annotateMethod(annotationDescription)
      .make()
      .load(ClassThatNeedsToBeAnnotated.class.getClassLoader(), ClassReloadingStrategy.fromInstalledAgent());
  </code></pre>
  
  <p>I'm sure that I just don't do it right but unfortunately cannot find an example when there is <strong>no code change</strong> for the method and only annotation change.</p>