title: Annotation is not inherited from interface method
body: <p>I have an interface with an annotated method. The annotation is marked with <code>@Inherited</code>, so I expect an implementor to inherit it. However, it is not the case:</p>
  <p>Code:</p>
  <pre><code>import java.lang.annotation.Inherited;
  import java.lang.annotation.Retention;
  import java.lang.annotation.RetentionPolicy;
  import java.lang.reflect.Method;
  import java.util.Arrays;
  
  public class Example {
  
      public static void main(String[] args) throws SecurityException, NoSuchMethodException {
          TestInterface obj = new TestInterface() {
              @Override
              public void m() {}
          };
  
          printMethodAnnotations(TestInterface.class.getMethod(&quot;m&quot;));
          printMethodAnnotations(obj.getClass().getMethod(&quot;m&quot;));
      }
  
      private static void printMethodAnnotations(Method m) {
          System.out.println(m + &quot;: &quot; + Arrays.toString(m.getAnnotations()));
      }
  }
  
  interface TestInterface {
      @TestAnnotation
      public void m();
  }
  
  @Retention(RetentionPolicy.RUNTIME)
  @Inherited
  @interface TestAnnotation {}
  </code></pre>
  <p>The above code prints:</p>
  <blockquote>
  <p>public abstract void annotations.TestInterface.m(): [@annotations.TestAnnotation()]</p>
  <p>public void annotations.Example$1.m(): []</p>
  </blockquote>
  <p>So the question is why does not the <code>obj.m()</code> have <code>@TestAnnotation</code> despite that it implements a method marked with <code>@TestAnnotation</code> which is <code>@Inherited</code>?</p>