Introduce kotlin.Cloneable

- 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
This commit is contained in:
Alexander Udalov
2014-07-21 22:10:53 +04:00
parent f3309d1fa7
commit fb958897a9
33 changed files with 392 additions and 38 deletions
+24 -8
View File
@@ -18,75 +18,91 @@
package kotlin
public class ByteArray(public val size: Int) {
public class ByteArray(public val size: Int) : Cloneable {
public fun get(index: Int): Byte
public fun set(index: Int, value: Byte): Unit
public fun iterator(): ByteIterator
public val indices: IntRange
public override fun clone(): ByteArray
}
public class CharArray(public val size: Int) {
public class CharArray(public val size: Int) : Cloneable {
public fun get(index: Int): Char
public fun set(index: Int, value: Char): Unit
public fun iterator(): CharIterator
public val indices: IntRange
public override fun clone(): CharArray
}
public class ShortArray(public val size: Int) {
public class ShortArray(public val size: Int) : Cloneable {
public fun get(index: Int): Short
public fun set(index: Int, value: Short): Unit
public fun iterator(): ShortIterator
public val indices: IntRange
public override fun clone(): ShortArray
}
public class IntArray(public val size: Int) {
public class IntArray(public val size: Int) : Cloneable {
public fun get(index: Int): Int
public fun set(index: Int, value: Int): Unit
public fun iterator(): IntIterator
public val indices: IntRange
public override fun clone(): IntArray
}
public class LongArray(public val size: Int) {
public class LongArray(public val size: Int) : Cloneable {
public fun get(index: Int): Long
public fun set(index: Int, value: Long): Unit
public fun iterator(): LongIterator
public val indices: IntRange
public override fun clone(): LongArray
}
public class FloatArray(public val size: Int) {
public class FloatArray(public val size: Int) : Cloneable {
public fun get(index: Int): Float
public fun set(index: Int, value: Float): Unit
public fun iterator(): FloatIterator
public val indices: IntRange
public override fun clone(): FloatArray
}
public class DoubleArray(public val size: Int) {
public class DoubleArray(public val size: Int) : Cloneable {
public fun get(index: Int): Double
public fun set(index: Int, value: Double): Unit
public fun iterator(): DoubleIterator
public val indices: IntRange
public override fun clone(): DoubleArray
}
public class BooleanArray(public val size: Int) {
public class BooleanArray(public val size: Int) : Cloneable {
public fun get(index: Int): Boolean
public fun set(index: Int, value: Boolean): Unit
public fun iterator(): BooleanIterator
public val indices: IntRange
public override fun clone(): BooleanArray
}