title: How to get constructor of a class with a generic parameter in the constructor
body: <p>The problem: To get parameterized constructor reference of subclasses of A (such as class H shown below) in class C.</p>
  
  <pre><code>Class A&lt;T extends B&gt; {
    public A(T objectT, D objectD, E objectE, F objectF) {
  
    }
  
    public T aMethodWithTAsReturnType();
  }
  
  Class B { }
  
  Class C&lt;T extends A&lt;?&gt;&gt; {
    private Constructor&lt;?&gt; classAConstructor;
    public C(Class&lt;T&gt; classA) {
       classAConstructor=classA.getConstructor(B.class, D.class,E.class,F.class)
    }
  }
  
  Class H extends A&lt;X&gt; {
    public H(X objectX, D objectD, E objectE, F objectF) {}
  }
  
  Class X extends B {}
  
  new C(new H(objectX,objectD,objectE,objectF));
  </code></pre>
  
  <p>The above code configuration would result in a <code>NoSuchMethodException</code> when a new Class C object is created because it cannot find the constructor for Class A</p>
  
  <p>I am now trying to use:</p>
  
  <pre><code>Method methodInA = classA.getMethod('aMethodWithTAsReturnType')
  Class&lt;?&gt; TClassInA = methodInA.getReturnType();
  </code></pre>
  
  <p>as a replacement for <code>B.class</code> in the <code>classA.getConstructor</code> line as I'm guessing that's the issue here because class B is a super type of T (in Class A).</p>
  
  <p>However... when I used methodInA.getReturnType() it returns B.class! rather than a class that has extended B. I then found a <code>getGenericReturnType()</code> method but it returns a Type object.</p>