Kotlin and static methods

Suppose, you have the following setup in Java:

public class Base {
    public static void doStuff() {}
}

public class Derived extends Base {
  
}


It seems that the following call is not possible in Kotlin:

Derived.doStuff()

The IDE shows no errors but the compiler complains “Unresolved reference: doStuff()”.

Is this behavior by design or is this simply a bug?

Before someone complains why I would want to do that: The reason is compatibility with Java libraries. For example, AssertJ has a lot of assertThat methods that are declared in org.assertj.core.api.StrictAssertions and some more that are declared in org.assertj.core.api.Assertions. Class Assertions is derived from StrictAssertions. In Java you only need one static import for class Assertions, whereas in Kotlin you would need two.

Kotlin Compiler 0.12.1218

Hi Dirk,

it’s by design, ide bug fixed in 0.13 branch