Java rectrictions that Kotlin follows


Now when Kotlin become multi platform I wonder if Kotlin Team have any plans of removing ‘Java restrictions’ from language (release restrictions in syntax but implement them at Kotlin compiler level)?

I mean mainly restrictions related to JVM type erasure limitations (need for reified type parameters, no proper runtime checking of collection type ‘list is List’) or no way of declaring generic non-extension property val x: T = TODO()

In general what do you think?


We have no plans to change how generics work on the JVM. Languages like Ceylon show that it’s perfectly possible to implement reified generics on the JVM, but the cost of that is making Java interop much harder. Support for other platforms doesn’t make Java interop any less important for Kotlin/JVM. (Not to mention that changing this would be a huge breaking change.)

The restriction on declaring top-level generic non-extension properties has nothing to do with “Java restrictions”; the only reason why this is not supported is that this feature makes no sense to us.