File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes What is wrong with Generics? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "What is wrong with Generics?" Watch "What is wrong with Generics?" New topic

What is wrong with Generics?

Piet Souris
Ranch Hand

Joined: Mar 08, 2009
Posts: 982
Thanks Pat, for bringing us all back into the real world

But to end (?) this topic in a more positive way:

What is great about Generics?

1) I like them a lot, type erasure or not

But most of all:

2) they sometimes give rise to very interesting and entertaining topics!
Winston Gutkowski

Joined: Mar 17, 2011
Posts: 8956

Pat Farrell wrote:On the more general topic: what is wrong with Generics, their design and implementation?

My answer:
1. People expect too much of it.
2. The compiler warnings are crap.

If you actually read Gilad Bracha's paper (now, thankfully, translated to the tutorials), he explains the issues with implementation, which basically boils down to the fact that, for whatever reasons, Java was NOT able to make typed classes first-class objects, so they chose the next best option that was backwards bytecode-compatible: type erasure.


Bats fly at night, 'cause they aren't we. And if we tried, we'd hit a tree -- Ogden Nash (or should've been).
Articles by Winston can be found here
I agree. Here's the link:
subject: What is wrong with Generics?
It's not a secret anymore!