recently I have been reading somewhat more about Java Generics and came to this article: http://gafter.blogspot.nl/2004/09/puzzling-through-erasure-answer.html, which basically says that Java will always be backwards compatible.
Now, what has Java done to JComboBox? Code written in Java 7, ie. JComboBox<String> comboBox = new JComboBox<>();
should compile just fine in Java 6, but then as a raw type as the type has been erased.
However as you can easily see when googling this, there are three different issues now:
- First of all, Java 6 does not compile on Generics, while it should do so with type erasure and treat it as a raw type.
- Secondly, not even reification is being used, so nothing is gained in Java 7.
- And thirdly, Java 7 code that uses raw types gives warnings.
So there does not seem to be a correct way.
Regards.