title: How to access type annotations on a receiver type's parameters
body: <p>I am looking at a rather trivial class with a single method that defines an annotated <em>receiver type</em>:</p>
  
  <pre><code>class Foo&lt;T&gt; { 
    void foo(Foo&lt;@Bar T&gt; this) {}
  }
  </code></pre>
  
  <p>I would now like to access the type annotation on the receiver type's parameter <code>@Bar</code> but the Java reflection API returns an annotated raw type when accessing the receiver:</p>
  
  <pre><code>assert Foo.class.getDeclaredMethod("foo")
                  .getAnnotatedReceiverType() 
    instanceof AnnotatedParameterizedType;
  </code></pre>
  
  <p>The assertion fails as the annotated type that is returned is returned as a raw type <code>Foo</code>. Is this intentional? I can still find the <code>@Bar</code> annotation when accessing private properties of the implementation of <code>AnnotatedType</code> that is returned.</p>
  
  <p>I am running a recent version of Java 8.</p>