3 ms·
It missed my favorite: contravariant arrays (or is it covariant, I last did work on this more than a decade ago. Specifically you can do (forgive syntax it’s a
by olliej 8y ago
It missed my favorite: contravariant arrays (or is it covariant, I last did work on this more than a decade ago.
Specifically you can do (forgive syntax it’s also been a long time since I wrote java)
X = new String[10]
Ovject[] o = X
o[0] = 1; // this will auto box, and then fail at runtime
Note that this isn’t a “bug” as it predates any version of generics so collection types especially are much saber if you support this. That said it does result in a logical error in which you can’t assign something that looks like it should be fine.
.Net unfortunately picked up this design decision in order to support java on their vm.