mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-11 00:21:29 +00:00
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:
@@ -2,5 +2,5 @@ package test
|
||||
|
||||
public open class MethodTypePOneUpperBound {
|
||||
public constructor MethodTypePOneUpperBound()
|
||||
public open fun </*0*/ T : java.lang.Cloneable?> bar(): kotlin.Unit
|
||||
public open fun </*0*/ T : kotlin.Cloneable?> bar(): kotlin.Unit
|
||||
}
|
||||
|
||||
@@ -2,5 +2,5 @@ package test
|
||||
|
||||
public open class MethodTypePTwoUpperBounds {
|
||||
public constructor MethodTypePTwoUpperBounds()
|
||||
public open fun </*0*/ T : java.lang.Cloneable?> foo(): kotlin.Unit where T : java.lang.Runnable?
|
||||
public open fun </*0*/ T : kotlin.Cloneable?> foo(): kotlin.Unit where T : java.lang.Runnable?
|
||||
}
|
||||
|
||||
@@ -2,5 +2,5 @@ package test
|
||||
|
||||
public open class MethodWithTypeParameters {
|
||||
public constructor MethodWithTypeParameters()
|
||||
public open fun </*0*/ A, /*1*/ B : java.lang.Runnable> foo(/*0*/ a: A, /*1*/ b: kotlin.List<B>, /*2*/ c: kotlin.MutableList<in kotlin.String?>): kotlin.Unit where B : kotlin.List<java.lang.Cloneable>
|
||||
public open fun </*0*/ A, /*1*/ B : java.lang.Runnable> foo(/*0*/ a: A, /*1*/ b: kotlin.List<B>, /*2*/ c: kotlin.MutableList<in kotlin.String?>): kotlin.Unit where B : kotlin.List<kotlin.Cloneable>
|
||||
}
|
||||
|
||||
@@ -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>?
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user