diff --git a/core/builtins/src/kotlin/reflect/KProperty.kt b/core/builtins/src/kotlin/reflect/KProperty.kt index a8965196b0d..0fb3c3f1397 100644 --- a/core/builtins/src/kotlin/reflect/KProperty.kt +++ b/core/builtins/src/kotlin/reflect/KProperty.kt @@ -20,6 +20,7 @@ package kotlin.reflect /** * Represents a property, such as a named `val` or `var` declaration. * Instances of this class are obtainable by the `::` operator. + * * See the [Kotlin language documentation](http://kotlinlang.org/docs/reference/reflection.html) * for more information. * @@ -98,6 +99,11 @@ public interface KProperty0 : KProperty, () -> R { override val getter: Getter + /** + * Getter of the property is a `get` method declared alongside the property. + * + * Can be used as a function that takes 0 arguments and returns the value of the property type [R]. + */ public interface Getter : KProperty.Getter, () -> R } @@ -114,6 +120,11 @@ public interface KMutableProperty0 : KProperty0, KMutableProperty { override val setter: Setter + /** + * Setter of the property is a `set` method declared alongside the property. + * + * Can be used as a function that takes new property value as an argument and returns [Unit]. + */ public interface Setter : KMutableProperty.Setter, (R) -> Unit } @@ -146,13 +157,18 @@ public interface KProperty1 : KProperty, (T) -> R { * For example, it should be a class instance if this is a member property of that class, * or an extension receiver if this is a top level extension property. * - * @see [KProperty1.getExtensionDelegate] + * @see [kotlin.reflect.full.getExtensionDelegate] // [KProperty1.getExtensionDelegate] */ @SinceKotlin("1.1") public fun getDelegate(receiver: T): Any? override val getter: Getter + /** + * Getter of the property is a `get` method declared alongside the property. + * + * Can be used as a function that takes an argument of type [T] (the receiver) and returns the value of the property type [R]. + */ public interface Getter : KProperty.Getter, (T) -> R } @@ -172,6 +188,11 @@ public interface KMutableProperty1 : KProperty1, KMutableProperty override val setter: Setter + /** + * Setter of the property is a `set` method declared alongside the property. + * + * Can be used as a function that takes the receiver and the new property value as arguments and returns [Unit]. + */ public interface Setter : KMutableProperty.Setter, (T, R) -> Unit } @@ -207,13 +228,19 @@ public interface KProperty2 : KProperty, (D, E) -> R { * @param receiver1 the instance of the first receiver. * @param receiver2 the instance of the second receiver. * - * @see [KProperty2.getExtensionDelegate] + * @see [kotlin.reflect.full.getExtensionDelegate] // [KProperty2.getExtensionDelegate] */ @SinceKotlin("1.1") public fun getDelegate(receiver1: D, receiver2: E): Any? override val getter: Getter + /** + * Getter of the property is a `get` method declared alongside the property. + * + * Can be used as a function that takes an argument of type [D] (the first receiver), an argument of type [E] (the second receiver) + * and returns the value of the property type [R]. + */ public interface Getter : KProperty.Getter, (D, E) -> R } @@ -232,5 +259,11 @@ public interface KMutableProperty2 : KProperty2, KMutablePrope override val setter: Setter + /** + * Setter of the property is a `set` method declared alongside the property. + * + * Can be used as a function that takes an argument of type [D] (the first receiver), an argument of type [E] (the second receiver), + * and the new property value and returns [Unit]. + */ public interface Setter : KMutableProperty.Setter, (D, E, R) -> Unit }