Effective Kotlin: Item 21 — Design interfaces for posterity

Java 8 introduced default methods to help with the addition of new methods to existing interfaces. However, as Joshua Bloch’s Effective Java points out this is still fraught with risk. The book gives a real-world example of the addition of removeIf where particular Collection implementations will fail at runtime.

With Kotlin we are no more protected from the same risks highlighted, but additionally, we also need to consider Java interoperability. As presented in item 20, Kotlin’s default implementations by design are not based…