I noticed something while I was derping around with generics. In the example below, doStuff1 compiles but doStuff2 doesn\'t:
public
If getClass() returns Class extends X>, nothing really bad can happen; actually it'll help a lot of use cases.
The only problem is, it is not theoretically correct. if an object is an ArrayList, its class cannot be Class - there is no such class, there is only a Class.
This is actually not related to erasure. If one day Java gets full reified types, getClass() should still return Class extends |X|>; however there should be a new method, like getType() which can return a more detailed Type extends X>. (though, getType may conflict with a lot of existing classes with their own getType methods)
For the timing being, since Class extends X> might be useful in a lot of cases, we can design our own method that does that
static Class extends X> myGetClass(X x){ ... }
but it's understandable they wouldn't put this kind of hack in standard lib.