title: Generic type omitted on method call
body: <p>I have an interface with a method of interface</p>
  
  <pre><code>&lt;A extends Annotation&gt; A getAnnotation(Class&lt;A&gt; annotationType)
  </code></pre>
  
  <p>the implementation of the class implements the method by wrapping</p>
  
  <pre><code>javax.lang.model.element.Element.getAnnotation(...)
  </code></pre>
  
  <p>which has the exact same interface.
  when i now try to call my own implementation I get the error <code>incompatible types: java.lang.annotation.Annotation cannot be converted to myannotation</code></p>
  
  <p>bear in mind the <code>getElement()</code> function was added for testing and is not supposed to stay</p>
  
  <p>the interface:</p>
  
  <pre><code>public interface ElementWrapper&lt;E extends Element&gt; {
    &lt;A extends Annotation&gt; A getAnnotation(Class&lt;A&gt; annotationType);
    E getElement();
  }
  </code></pre>
  
  <p>the implementation:</p>
  
  <pre><code>public class TypeWrapper implements ElementWrapper&lt;TypeElement&gt; {
    private static final TypeElement element;
  
    @Override
    public final &lt;A extends Annotation&gt; A getAnnotation(Class&lt;A&gt; annotationType) {
      return element.getAnnotation(annotationType);
    }
  
    @Override
    public final TypeElement getElement() {
      return element;
    }
  }
  </code></pre>
  
  <p>the usage with the problem:</p>
  
  <pre><code>public class TheClassIUseTypeWrapperIn {
    public someMethod(TypeWrapper wrapper) {
      MyAnnotation = wrapper.getElement().getAnnotation(MyAnnotation.class); // this works fine
      MyAnnotation = wrapper.getAnnotation(MyAnnotation.class); // this does not work
    }
  }
  </code></pre>
  
  <p>i expect my wrapper to work</p>