title: Dynamically add annotation to an existing class
body: <p>I have the following class</p>
  
  <pre><code>public class Person {
     ...
  }
  </code></pre>
  
  <p>I would like to create another class that would look like this.</p>
  
  <pre><code>@SomeAnnotation
  public class Person {
     ...
  }
  </code></pre>
  
  <p>Via a simple method like so.</p>
  
  <pre><code>public static Class addAnnotation(Class originalType, Class&lt;? extends Annotation&gt; annotation) {
     // what goes here?
  }
  </code></pre>
  
  <p>Is there an easy way to do this via ASM for example? What dependencies would I need. I have tried to Google this however the examples I have found are either incomplete or are doing something else. Other frameworks such as javassist would be just as good.</p>