Effective Kotlin: Item 13 — Override clone judiciously

With Effective Java’s item 13 on cloning, it is clear to me that Joshua Bloch’s advice is to avoid the complexities of the clone method. Indeed, he suggests “a better approach to object copying is to provide a copy constructor or copy factory”.

Kotlin has taken this advice from Effective Java with the implementation of a copy function when you create a data class. copy creates a new instance with the default constructor, avoiding a lot of the complexities of clone while additionally allowing overriding of any of its properties.