In such a function:
void foo(T obj)
The type of obj.getClass()
is Class>
and not Class<
The basic problem is that getClass() doesn't return the class because its defined at the Object level. i.e. it is mearly defined as a class which extends object. They could have defined getClass() like.
Class getClass() { /**/ }
but instead its
Class> getClass()
which means generics has no understanding of what getClass returns.