Update stdlib usages of PropertyMetadata to KProperty<*>

This commit is contained in:
Alexander Udalov
2015-10-14 20:06:37 +03:00
parent 43bb9347c6
commit 556a169a5d
10 changed files with 67 additions and 62 deletions
@@ -16,16 +16,16 @@
package org.jetbrains.kotlin.utils
import kotlin.properties.ReadOnlyProperty
import kotlin.reflect.KProperty
public class CachedValueProperty<TValue : Any, TTimestamp : Any>(
private val calculator: () -> TValue,
private val timestampCalculator: () -> TTimestamp
) : ReadOnlyProperty<Any?, TValue> {
) {
private var value: TValue? = null
private var timestamp: TTimestamp? = null
public override fun getValue(thisRef: Any?, desc: PropertyMetadata): TValue {
operator fun getValue(thisRef: Any?, property: KProperty<*>): TValue {
val currentTimestamp = timestampCalculator()
if (value == null || timestamp != currentTimestamp) {
value = calculator()