diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/callInMemberValDelegateRuntime.kt b/idea/testData/quickfix/createFromUsage/createClass/callExpression/callInMemberValDelegateRuntime.kt index 05bd0791b3d..6c3d2967448 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/callExpression/callInMemberValDelegateRuntime.kt +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/callInMemberValDelegateRuntime.kt @@ -1,5 +1,5 @@ // "Create class 'Foo'" "true" -// ERROR: Class 'Foo' must be declared abstract or implement abstract member
public abstract fun get(thisRef: A<T>, desc: kotlin.PropertyMetadata): B defined in kotlin.properties.ReadOnlyProperty +// ERROR: Class 'Foo' must be declared abstract or implement abstract member
public abstract fun get(thisRef: A<T>, property: kotlin.PropertyMetadata): B defined in kotlin.properties.ReadOnlyProperty open class B diff --git a/idea/testData/quickfix/createFromUsage/createClass/callExpression/callInMemberValDelegateRuntime.kt.after b/idea/testData/quickfix/createFromUsage/createClass/callExpression/callInMemberValDelegateRuntime.kt.after index e02d315a67f..6e7cb7ad977 100644 --- a/idea/testData/quickfix/createFromUsage/createClass/callExpression/callInMemberValDelegateRuntime.kt.after +++ b/idea/testData/quickfix/createFromUsage/createClass/callExpression/callInMemberValDelegateRuntime.kt.after @@ -1,7 +1,7 @@ import kotlin.properties.ReadOnlyProperty // "Create class 'Foo'" "true" -// ERROR: Class 'Foo' must be declared abstract or implement abstract member
public abstract fun get(thisRef: A<T>, desc: kotlin.PropertyMetadata): B defined in kotlin.properties.ReadOnlyProperty +// ERROR: Class 'Foo' must be declared abstract or implement abstract member
public abstract fun get(thisRef: A<T>, property: kotlin.PropertyMetadata): B defined in kotlin.properties.ReadOnlyProperty open class B diff --git a/libraries/stdlib/src/kotlin/properties/Delegation.kt b/libraries/stdlib/src/kotlin/properties/Delegation.kt index 16e3e6792ce..7c96cd7f950 100644 --- a/libraries/stdlib/src/kotlin/properties/Delegation.kt +++ b/libraries/stdlib/src/kotlin/properties/Delegation.kt @@ -79,11 +79,11 @@ public object Delegates { private class NotNullVar() : ReadWriteProperty { private var value: T? = null - public override fun get(thisRef: Any?, desc: PropertyMetadata): T { - return value ?: throw IllegalStateException("Property ${desc.name} should be initialized before get") + public override fun get(thisRef: Any?, property: PropertyMetadata): T { + return value ?: throw IllegalStateException("Property ${property.name} should be initialized before get.") } - public override fun set(thisRef: Any?, desc: PropertyMetadata, value: T) { + public override fun set(thisRef: Any?, property: PropertyMetadata, value: T) { this.value = value } } @@ -99,12 +99,12 @@ public class ObservableProperty( ) : ReadWriteProperty { private var value = initialValue - public override fun get(thisRef: Any?, desc: PropertyMetadata): T { + public override fun get(thisRef: Any?, property: PropertyMetadata): T { return value } - public override fun set(thisRef: Any?, desc: PropertyMetadata, value: T) { - if (onChange(desc, this.value, value)) { + public override fun set(thisRef: Any?, property: PropertyMetadata, value: T) { + if (onChange(property, this.value, value)) { this.value = value } } @@ -123,7 +123,7 @@ private fun unescape(value: Any?): Any? { private class LazyVal(private val initializer: () -> T) : ReadOnlyProperty { private var value: Any? = null - public override fun get(thisRef: Any?, desc: PropertyMetadata): T { + public override fun get(thisRef: Any?, property: PropertyMetadata): T { if (value == null) { value = escape(initializer()) } @@ -135,7 +135,7 @@ private class BlockingLazyVal(lock: Any?, private val initializer: () -> T) : private val lock = lock ?: this private volatile var value: Any? = null - public override fun get(thisRef: Any?, desc: PropertyMetadata): T { + public override fun get(thisRef: Any?, property: PropertyMetadata): T { val _v1 = value if (_v1 != null) { return unescape(_v1) as T @@ -183,17 +183,17 @@ public abstract class MapVal() : ReadOnlyProperty { /** * Returns the property value to be used when the map does not contain the corresponding key. * @param ref the object instance for which the value was requested. - * @param desc the property for which the value was requested. + * @param property the property for which the value was requested. */ - protected open fun default(ref: T, desc: PropertyMetadata): V { - throw KeyMissingException("Key $desc is missing in $ref") + protected open fun default(ref: T, property: PropertyMetadata): V { + throw KeyMissingException("The value for property ${property.name} is missing in $ref.") } - public override fun get(thisRef: T, desc: PropertyMetadata) : V { + public override fun get(thisRef: T, property: PropertyMetadata) : V { val map = map(thisRef) - val key = key(desc) + val key = key(property) if (!map.containsKey(key)) { - return default(thisRef, desc) + return default(thisRef, property) } return map[key] as V @@ -209,14 +209,14 @@ public abstract class MapVal() : ReadOnlyProperty { public abstract class MapVar() : MapVal(), ReadWriteProperty { protected abstract override fun map(ref: T): MutableMap - public override fun set(thisRef: T, desc: PropertyMetadata, value: V) { + public override fun set(thisRef: T, property: PropertyMetadata, value: V) { val map = map(thisRef) - map.put(key(desc), value) + map.put(key(property), value) } } private val defaultKeyProvider:(PropertyMetadata) -> String = {it.name} -private val defaultValueProvider:(Any?, Any?) -> Nothing = {thisRef, key -> throw KeyMissingException("$key is missing from $thisRef")} +private val defaultValueProvider:(Any?, Any?) -> Nothing = {thisRef, key -> throw KeyMissingException("The value for key $key is missing from $thisRef.")} /** * Implements a read-only property delegate that stores the property values in a given map instance and uses the given @@ -236,8 +236,8 @@ public open class FixedMapVal(private val map: Map, return (key)(desc) } - protected override fun default(ref: T, desc: PropertyMetadata): V { - return (default)(ref, key(desc)) + protected override fun default(ref: T, property: PropertyMetadata): V { + return (default)(ref, key(property)) } } @@ -259,7 +259,7 @@ public open class FixedMapVar(private val map: MutableMap, return (key)(desc) } - protected override fun default(ref: T, desc: PropertyMetadata): V { - return (default)(ref, key(desc)) + protected override fun default(ref: T, property: PropertyMetadata): V { + return (default)(ref, key(property)) } } diff --git a/libraries/stdlib/src/kotlin/properties/Interfaces.kt b/libraries/stdlib/src/kotlin/properties/Interfaces.kt index 871a25b7db7..0e35b538484 100644 --- a/libraries/stdlib/src/kotlin/properties/Interfaces.kt +++ b/libraries/stdlib/src/kotlin/properties/Interfaces.kt @@ -14,10 +14,10 @@ public interface ReadOnlyProperty { /** * Returns the value of the property for the given object. * @param thisRef the object for which the value is requested. - * @param desc the metadata for the property. + * @param property the metadata for the property. * @return the property value. */ - public fun get(thisRef: R, desc: PropertyMetadata): T + public fun get(thisRef: R, property: PropertyMetadata): T } /** @@ -33,16 +33,16 @@ public interface ReadWriteProperty { /** * Returns the value of the property for the given object. * @param thisRef the object for which the value is requested. - * @param desc the metadata for the property. + * @param property the metadata for the property. * @return the property value. */ - public fun get(thisRef: R, desc: PropertyMetadata): T + public fun get(thisRef: R, property: PropertyMetadata): T /** * Sets the value of the property for the given object. * @param thisRef the object for which the value is requested. - * @param desc the metadata for the property. + * @param property the metadata for the property. * @param value the value to set. */ - public fun set(thisRef: R, desc: PropertyMetadata, value: T) + public fun set(thisRef: R, property: PropertyMetadata, value: T) }