udalov
instance: T, and the actual argument could be either the type T itself, or its subtype. However ClassFactory’s constructor takes clazz: Class<T> which means exactly the class of T, because java.lang.Class is invariant on its type parameter. Is this intended?