Package com.intellij.psi.util

Interface CachedValue<T>

This is enforced at runtime by occasional checks in CachedValueStabilityChecker. See that class's documentation for further information and advice, when a failure happens.

Recursion prevention: The same cached value provider can be re-entered recursively on the same thread, if the computation is inherently cyclic. Note that this is likely to result in StackOverflowError, so avoid such situations at all cost. If there's no other way, use RecursionManager.doPreventingRecursion(java.lang.Object, boolean, com.intellij.openapi.util.Computable<T>) instead of custom thread-locals to help get out of the endless loop. Please ensure this call happens inside the CachedValueProvider, not outside getValue() call. Otherwise you might get no caching at all, because CachedValue uses RecursionGuard.StackStamp#mayCacheNow() to prevent caching incomplete values, and even the top-level call would be considered incomplete if it happens inside doPreventingRecursion.
See Also:
CachedValueProvider, CachedValuesManager
Skip navigation links

This is unofficial documentation and not affiliated with Jetbrains s.r.o. at all. We can not guarantee the correctness of this documentation.