Settings

Theme

State of the Specialization: Generics over primitives in Java and JVM

cr.openjdk.java.net

83 points by udalov 11 years ago · 1 comment

Reader

paol 11 years ago

Interesting. This just reinforces my opinion that they made a terrible decision with the original implementation of generics in Java. Basically they set themselves the constraint that generics would have to be implemented without touching the JVM, in the name of a completely unnecessary form of forward compatibility (basically you can compile generics-using code in Java 1.5 and run it on a 1.4 JVM).

The only upside was that the existing collection classes could be "upgraded" to generics, rather than having to create a new set of collections classes. When faced with the same decision, C# went ahead and did just that - eliciting complaints from exactly no-one - and in return gained powerful and robust support for generics at the VM level. Contrast that with the contortions being proposed in the article just to try to extend Java generics to fundamental types.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection