I want to get a Parametrized class which is able to return an object of type T AND children of T

This is the code:

```
import java.lang.reflect.InvocationTargetException;

class A {};

class B extends A {};

public class testGenerics<T extends A> {

  T a;

  T getA() {
    return getA(B.class); // Compilation problem:
    //The method getA(Class<T>) in the type testGenerics<T> is not applicable for the arguments (Class<B>)
  }

  T getA(Class<T> clazz) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
      return clazz.getConstructor().newInstance();
  }

}

```

This is how I think:

I am declaring generic type T, that extends A. Therefore, I can create from Class clazz an instance of type T extending A.

However, when I decide to get A from B.class (Which extends A):

```
getA(B.class)

```

I get following error:

> 
> The method getA(Class< T >) in the type testGenerics< T > is not applicable for the arguments (Class< B >)
> 
> 
> 

Why is this? How can I fix it?