3 ms·
That's a Java thing, not a JVM thing. Try Kotlin for example.
by RhodesianHunter 8y ago
That's a Java thing, not a JVM thing. Try Kotlin for example.
- mruts 8y agoThat’s not true. Type erasure is certainly a part of the JVM. I’m not familiar with Kotlin but maybe it does automatic type tagging? But in response to GP, type erasure sucks and makes a lot of things harder.
- pron 8y ago> Type erasure is certainly a part of the JVM No, it is not. Most JVM languages (except Ceylon, I think) choose to erase generics, as that's the right thing to do if you want good polyglot interop.
- mruts 8y agoNo, I mean that the JVM itself doesn’t have opcodes for storing generics type info. Hence why it was done for backward compatability, they didn’t need to add or change instructions.
- pron 8y agoThat's incorrect. You could specialize classes on the fly (and the opcodes for all reference types are the same, anyway). It's just that it's a bad idea to reify generics of reference (and so subtypable) types. You gain little and lose much.
- mruts 8y agoOk I looked it up. You’re right. Kudos