Pregunta

I know this question will probably provoke more discussion than concrete answers (which I know isn't preferable). But with the recent acquisition by Oracle, I was wondering if there's been any word that Java might (someday) get reified generics? I've heard that Oracle wants to give Java a bit of a boost, and I can think of no better way.

¿Fue útil?

Solución

There's a good article on the discussion of reified generics, here, that you should read in regards to Java. Basically it outlines some of the pitfalls that might happen with the introduction of such a change. It's fairly brutal for backwards compatibility when you think about it. Picked it up on Hacker News if you're wondering where it came from.

Be grateful that there's talk of adding closures to Java. No more having to slog through with only things like Functional Java and their ilk (not that these were bad, on the contrary.)

Otros consejos

I don't know about the future beyond Java 7 but it looks like Reified Generics won't be in Java 7 (and if Oracle wants to give Java a bit of boost, they should start with releasing Java 7).

Contrary to what almost everyone believe, reified Generics is possible in Java, which means that type erasure can be avoided. Actually, it is a trick or pure dark magic if you will.

I've written an article on this at

http://rgomes-info.blogspot.co.uk/2013/12/using-typetokens-to-retrieve-generic.html

In the end of the article there's a section on pros and cons of this trick. Actually, the correct thing would be having "proper" reified Generics in Java and not a trick like this... but unfortunately this is not the case.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top