[Edited] Kotlin cannot create non-final static methods

Original post:

Situation: I have to use a Kotlin-based library in a Java project. I must override a static getter method in a class that extends a class in Kotlin.

I realized that this is not possible since the method is final, and there is no way to modify the library Kotlin code to solve this.

Conclusion: since @JvmStatic annotations are meant for Java interoperability, I think they should generate static methods that are non-final.


Actually, I found out that adding @JvmStatic to a method in a companion object that is marked open works just fine! However, in IntelliJ, this warns

‘open’ has no effect in an object

which threw me off. I suppose this is something to be addressed in IntelliJ, and to go back one step, in the documentation of @JvmStatic.

Interesting, could you share your code?