I have several classes derived from common base class. 

```
public class BaseClass ...

public class ClassA extends BaseClass ...

public class ClassB extends BaseClass ...

```

I need to store those classes in list where I can retrieve them via their index and create specific instances at runtime and I can do that with following working code:

```
    List<Class> a = new ArrayList<Class>();
    a.add(ClassA.class);
    a.add(ClassB.class);

    Class c = a.get(0);
    BaseClass m = (BaseClass) c.getConstructor().newInstance();

```

I would like to know if there is any way I can tell that any class in that list has to be descendant of `BaseClass`. I want to ensure that only descendants of `BaseClass` can be added to the list. Something like following:

```
    List<Class<BaseClass>> a = new ArrayList<Class<BaseClass>>();
    a.add(ClassA.class);
    a.add(ClassB.class);

```

But above code throws compiler error:

```
Error:(135, 10) error: no suitable method found for add(Class<ClassA>)
method List.add(Class<BaseClass>) is not applicable
(actual argument Class<ClassA> cannot be converted to Class<BaseClass> by method invocation conversion)
method List.add(int,Class<BaseClass>) is not applicable
(actual and formal argument lists differ in length)
method Collection.add(Class<BaseClass>) is not applicable
(actual argument Class<ClassA> cannot be converted to Class<BaseClass> by method invocation conversion)

```