title: Check if field type is same as generic type in java
body: <p>I want to determine if a field is typed as the subclass of a generic type.</p>
  
  <p>For e.g</p>
  
  <pre><code>Foo extends Bar&lt;Foo&gt;
  
  Foo x;
  </code></pre>
  
  <p>How do I tell if the field x is typed as a subtype of <code>Bar&lt;Foo&gt;</code>?</p>