title: Java: cannot access annotations through reflection
body: <p>Here is a test class:</p>
  
  <pre><code>import java.lang.annotation.Annotation;
  import java.lang.reflect.Method;
  
  public class TestAnnotations {
  
      @interface Annotate{}
  
      @Annotate public void myMethod(){}
  
      public static void main(String[] args) {
          try{
              Method[] methods = TestAnnotations.class.getDeclaredMethods();
              Method m = methods[1];
              assert m.getName().equals("myMethod");
  
              System.out.println("method inspected ? " + m.getName());
              Annotation a = m.getAnnotation(Annotate.class);
              System.out.println("annotation ? " + a);
              System.out.println("annotations length ? "
                  + m.getDeclaredAnnotations().length);
          }
          catch(Exception e){
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>Here is my output : </p>
  
  <pre><code>method inspected ? myMethod
  annotation : null
  annotations length : 0
  </code></pre>
  
  <p>What I am missing to make annotations visible through reflection ?<br>
  Do I need an annotation processor even for just checking their presence ?</p>