From 304b5deacb2e1edf957aedf2b51ee9a79657332d Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Tue, 6 Sep 2016 16:37:29 +0300 Subject: [PATCH] Simplify KProperty implementations: get rid of KMutablePropertyImpl --- .../src/kotlin/reflect/jvm/internal/KProperty0Impl.kt | 4 ++-- .../src/kotlin/reflect/jvm/internal/KProperty1Impl.kt | 4 ++-- .../src/kotlin/reflect/jvm/internal/KProperty2Impl.kt | 4 ++-- .../src/kotlin/reflect/jvm/internal/KPropertyImpl.kt | 9 +-------- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KProperty0Impl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KProperty0Impl.kt index 5346a3c5413..347ca934532 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KProperty0Impl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KProperty0Impl.kt @@ -38,7 +38,7 @@ internal open class KProperty0Impl : DescriptorBasedProperty, KPropert } } -internal open class KMutableProperty0Impl : KProperty0Impl, KMutableProperty0, KMutablePropertyImpl { +internal class KMutableProperty0Impl : KProperty0Impl, KMutableProperty0 { constructor(container: KDeclarationContainerImpl, descriptor: PropertyDescriptor) : super(container, descriptor) constructor(container: KDeclarationContainerImpl, name: String, signature: String) : super(container, name, signature) @@ -49,7 +49,7 @@ internal open class KMutableProperty0Impl : KProperty0Impl, KMutableProper override fun set(value: R) = setter.call(value) - class Setter(override val property: KMutableProperty0Impl) : KMutablePropertyImpl.Setter(), KMutableProperty0.Setter { + class Setter(override val property: KMutableProperty0Impl) : KPropertyImpl.Setter(), KMutableProperty0.Setter { override fun invoke(value: R): Unit = property.set(value) } } diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KProperty1Impl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KProperty1Impl.kt index 6c1c64ec419..4007bc060d6 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KProperty1Impl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KProperty1Impl.kt @@ -38,7 +38,7 @@ internal open class KProperty1Impl : DescriptorBasedProperty, KProp } } -internal open class KMutableProperty1Impl : KProperty1Impl, KMutableProperty1, KMutablePropertyImpl { +internal class KMutableProperty1Impl : KProperty1Impl, KMutableProperty1 { constructor(container: KDeclarationContainerImpl, name: String, signature: String) : super(container, name, signature) constructor(container: KDeclarationContainerImpl, descriptor: PropertyDescriptor) : super(container, descriptor) @@ -49,7 +49,7 @@ internal open class KMutableProperty1Impl : KProperty1Impl, KMutable override fun set(receiver: T, value: R) = setter.call(receiver, value) - class Setter(override val property: KMutableProperty1Impl) : KMutablePropertyImpl.Setter(), KMutableProperty1.Setter { + class Setter(override val property: KMutableProperty1Impl) : KPropertyImpl.Setter(), KMutableProperty1.Setter { override fun invoke(receiver: T, value: R): Unit = property.set(receiver, value) } } diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KProperty2Impl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KProperty2Impl.kt index 590b825134b..d04f1555fa5 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KProperty2Impl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KProperty2Impl.kt @@ -38,7 +38,7 @@ internal open class KProperty2Impl : DescriptorBasedProperty, KP } } -internal open class KMutableProperty2Impl : KProperty2Impl, KMutableProperty2, KMutablePropertyImpl { +internal class KMutableProperty2Impl : KProperty2Impl, KMutableProperty2 { constructor(container: KDeclarationContainerImpl, name: String, signature: String) : super(container, name, signature) constructor(container: KDeclarationContainerImpl, descriptor: PropertyDescriptor) : super(container, descriptor) @@ -49,7 +49,7 @@ internal open class KMutableProperty2Impl : KProperty2Impl, KM override fun set(receiver1: D, receiver2: E, value: R) = setter.call(receiver1, receiver2, value) - class Setter(override val property: KMutableProperty2Impl) : KMutablePropertyImpl.Setter(), KMutableProperty2.Setter { + class Setter(override val property: KMutableProperty2Impl) : KPropertyImpl.Setter(), KMutableProperty2.Setter { override fun invoke(receiver1: D, receiver2: E, value: R): Unit = property.set(receiver1, receiver2, value) } } diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KPropertyImpl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KPropertyImpl.kt index 143a405059e..3f2fe344f84 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KPropertyImpl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KPropertyImpl.kt @@ -94,15 +94,8 @@ internal interface KPropertyImpl : KProperty, KCallableImpl { override val defaultCaller: FunctionCaller<*>? get() = null } -} - - -internal interface KMutablePropertyImpl : KMutableProperty, KPropertyImpl { - override val setter: Setter - - abstract class Setter : KPropertyImpl.Accessor(), KMutableProperty.Setter, KCallableImpl { - abstract override val property: KMutablePropertyImpl + abstract class Setter : Accessor(), KMutableProperty.Setter, KCallableImpl { override val name: String get() = "" override val container: KDeclarationContainerImpl get() = property.container