How can call public
using MyClass
as clazz where I can not instantiate or extend MyClas
How to do
MyClass
in Java?.class
Generics in Java use type erasure; the type of the parametrized argument is enforced during compilation, but it is lost after compilation. The resulting byte code for an instance of a generic class does not contain any run-time meta-data on its arguments whatsoever.
As it is now, it is just not possible, a major language design blunder IMO.