Any reason not to use platformStatic?


#1

I could be missing something simple, but if I have a method to which platformStatic could be applied, is there any reason not to? If there isn't, why couldn't platformStatic be added implicitly wherever possible? As it is it just seems like it makes the Kotlin code a bit ugly if you're aiming for good Java interoperability.


#2

First of all, platformStatic is inapplicable to some functions (e.g. those overridden from supertypes). Then, speaking of platformStatic in class objects, it may clash with members of the containing class, which may cause problems that can not be resolved automatically: e.g. a superclass adds a clashing method after the fact, and the subclass'es code has to change semantics to remain compilable... Having explicit annotations makes it all controllable by the user.


#3

Makes sense - I hadn't thought about the clashing issue. Thanks!