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
@@ -2,5 +2,5 @@ package test
public open class MissingUpperBound {
public constructor MissingUpperBound()
public open fun </*0*/ A : java.lang.Runnable?> foo(): kotlin.String? where A : java.lang.Cloneable?
public open fun </*0*/ A : java.lang.Runnable?> foo(): kotlin.String? where A : kotlin.Cloneable?
}
@@ -2,5 +2,5 @@ package test
public open class WrongTypeParameterBoundStructure1 {
public constructor WrongTypeParameterBoundStructure1()
public open fun </*0*/ A, /*1*/ B : java.lang.Runnable?> foo(/*0*/ p0: A?, /*1*/ p1: kotlin.List<B>?): kotlin.Unit where B : kotlin.List<java.lang.Cloneable>?
public open fun </*0*/ A, /*1*/ B : java.lang.Runnable?> foo(/*0*/ p0: A?, /*1*/ p1: kotlin.List<B>?): kotlin.Unit where B : kotlin.List<kotlin.Cloneable>?
}
@@ -6,7 +6,7 @@ import jet.runtime.typeinfo.KotlinSignature;
import org.jetbrains.jet.jvm.compiler.annotation.ExpectLoadError;
public class WrongTypeParameterBoundStructure2 {
@ExpectLoadError("'kotlin.List<java.lang.Cloneable>?' type in method signature has 1 type arguments, while 'List' in alternative signature has 0 of them")
@ExpectLoadError("'kotlin.List<kotlin.Cloneable>?' type in method signature has 1 type arguments, while 'List' in alternative signature has 0 of them")
@KotlinSignature("fun <A, B : Runnable> foo(a : A, b : List<B>) where B : List")
public <A, B extends Runnable & List<Cloneable>> void foo(A a, List<? extends B> b) {
}
@@ -2,5 +2,5 @@ package test
public open class WrongTypeParameterBoundStructure2 {
public constructor WrongTypeParameterBoundStructure2()
public open fun </*0*/ A, /*1*/ B : java.lang.Runnable?> foo(/*0*/ p0: A?, /*1*/ p1: kotlin.List<B>?): kotlin.Unit where B : kotlin.List<java.lang.Cloneable>?
public open fun </*0*/ A, /*1*/ B : java.lang.Runnable?> foo(/*0*/ p0: A?, /*1*/ p1: kotlin.List<B>?): kotlin.Unit where B : kotlin.List<kotlin.Cloneable>?
}