Do not run partial body resolve if full body resolve already cached

This commit is contained in:
Valentin Kipyatkov
2015-03-23 19:57:50 +03:00
parent 6aad2b2d65
commit 7a414336c1
5 changed files with 25 additions and 6 deletions
@@ -411,6 +411,12 @@ public class LockBasedStorageManager implements StorageManager {
lock.unlock();
}
}
@Override
public boolean isComputed(K key) {
Object value = cache.get(key);
return value != null && value != NotValue.COMPUTING;
}
}
private class MapBasedMemoizedFunctionToNotNull<K, V> extends MapBasedMemoizedFunction<K, V> implements MemoizedFunctionToNotNull<K, V> {
@@ -16,8 +16,13 @@
package org.jetbrains.kotlin.storage
public trait MemoizedFunctionToNotNull<P, R : Any> : Function1<P, R>
public trait MemoizedFunctionToNullable<P, R : Any> : Function1<P, R?>
public trait MemoizedFunctionToNotNull<P, R : Any> : Function1<P, R> {
public fun isComputed(key: P): Boolean
}
public trait MemoizedFunctionToNullable<P, R : Any> : Function1<P, R?> {
public fun isComputed(key: P): Boolean
}
public trait NotNullLazyValue<T : Any> : Function0<T> {
public fun isComputed(): Boolean