title: passing a Class that extends another Class
body: <p>I boiled the thing I want to do to the following minimal code:</p>
  
  <pre><code>public class TestClass {
  
      class Class2Extend {
      }
  
      class Foo {
          public Foo(Class&lt;Class2Extend&gt; myClass) {
  
          }
      }
  
      class Bar extends Class2Extend{
  
      }
  
      public TestClass() {
          new Foo(Class2Extend.class); // works fine 
              //new Foo(Bar.class); -&gt; fails even though Bar extends Class2Extend - but I want something like this to have nice code
      }
  }
  </code></pre>
  
  <p>I can use an interface but it would be cleaner this way. Anyone can give me a hint/trick on this problem?</p>