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
@@ -3,10 +3,10 @@ package test
public trait TwoBounds {
public trait Sub : test.TwoBounds.Super {
public abstract override /*1*/ fun </*0*/ B : kotlin.CharSequence> foo(/*0*/ a: B): kotlin.Unit where B : java.lang.Cloneable
public abstract override /*1*/ fun </*0*/ B : kotlin.CharSequence> foo(/*0*/ a: B): kotlin.Unit where B : kotlin.Cloneable
}
public trait Super {
public abstract fun </*0*/ A : kotlin.CharSequence> foo(/*0*/ a: A): kotlin.Unit where A : java.lang.Cloneable
public abstract fun </*0*/ A : kotlin.CharSequence> foo(/*0*/ a: A): kotlin.Unit where A : kotlin.Cloneable
}
}
@@ -3,10 +3,10 @@ package test
public trait TwoTypeParameters {
public trait Sub : test.TwoTypeParameters.Super {
public abstract override /*1*/ fun </*0*/ B : kotlin.CharSequence, /*1*/ A : java.lang.Cloneable> foo(/*0*/ a: B, /*1*/ b: A): kotlin.Unit
public abstract override /*1*/ fun </*0*/ B : kotlin.CharSequence, /*1*/ A : kotlin.Cloneable> foo(/*0*/ a: B, /*1*/ b: A): kotlin.Unit
}
public trait Super {
public abstract fun </*0*/ A : kotlin.CharSequence, /*1*/ B : java.lang.Cloneable> foo(/*0*/ a: A, /*1*/ b: B): kotlin.Unit
public abstract fun </*0*/ A : kotlin.CharSequence, /*1*/ B : kotlin.Cloneable> foo(/*0*/ a: A, /*1*/ b: B): kotlin.Unit
}
}