fb958897a9
- Cloneable is a trait with a single protected member 'clone', which is mapped to java.lang.Cloneable on JVM - 'clone' is non-abstract to be able to call 'super.clone()' in the implementations. Also if you need your class to be Cloneable, most of the time inheriting from Cloneable and calling 'super.clone()' will work - hack 'super.clone()' in JVM intrinsics and TImpl delegation generation - make arrays Cloneable, handle 'clone()' calls in the intrinsic #KT-4890 Fixed
9 lines
275 B
Kotlin
9 lines
275 B
Kotlin
public open class Test(): java.util.RandomAccess, Cloneable, java.io.Serializable
|
|
{
|
|
public override fun clone(): Test = Test() // Override 'clone()' with more precise type 'Test'
|
|
|
|
public override fun toString() = "OK"
|
|
}
|
|
|
|
fun box() = Test().clone().toString()
|