tomorrow work, the type needed to be known at runtime, which is not the case (because of erasure).
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Well Ilja's answer is technically more correct than mine.
During runtime, there is no more T, so how will the JVM know what to create? Just create Object? That's not what you want. But what else is there? Nothing!
The same goes for other references to T that would be required during runtime: - instanceof T - new T[...] - T.class - ...
Just remember: generics only exist during compile time, so anything that would require knowledge of T during runtime is not allowed.
That's also why casting to T is allowed - casts are a compile time mechanism. It does produce a warning though since there is no way to check if the object is actually an instance of T, since instanceof is not allowed. You can get past this if you get hold of an instance of Class<T> - Class does have a means to check if an object is an instance, so it has method a method called cast(Object) that returns the object as a T.
Joined: May 28, 2007
I must say now I'm completely satisfied with the answers. Of course I studied them and I believe now I can visualize the whys about not allowing that type of instantiation to happen, I'm so glad I asked. I prefer not to extend this reply any further, I have already taken much of your precious time, so what's left for me to say is thank you very much to both of you guys and good bye!