From 9dfaa3158635f68f6a55d9ef0dac1818796ff4b4 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 21 Mar 2019 18:42:44 +0100 Subject: [PATCH] CachedValue/IdempotenceChecker javadoc: more links, fix code --- platform/core-api/src/com/intellij/psi/util/CachedValue.java | 4 ++++ .../core-impl/src/com/intellij/util/IdempotenceChecker.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/platform/core-api/src/com/intellij/psi/util/CachedValue.java b/platform/core-api/src/com/intellij/psi/util/CachedValue.java index 1735b466d44b..7d27f95e2089 100644 --- a/platform/core-api/src/com/intellij/psi/util/CachedValue.java +++ b/platform/core-api/src/com/intellij/psi/util/CachedValue.java @@ -47,6 +47,8 @@ import org.jetbrains.annotations.NotNull; *
  • Cached arrays or lists should have the same number of elements, and they also should be equivalent and come in the same order.
  • *
  • If the result object's class has a meaningful {@link #equals} method, it should hold.
  • * + * This is enforced at runtime by occasional checks in {@link com.intellij.util.IdempotenceChecker#checkEquivalence(Object, Object, Class)}. + * See that method's documentation for further information and advice, when a failure happens.

    * * Context-independence: if you store the CachedValue in a field or user data of some object {@code X}, then its {@link CachedValueProvider} * may only depend on X and parts of global system state that don't change while {@code X} is alive and valid (e.g. application/project components/services). @@ -74,6 +76,8 @@ import org.jetbrains.annotations.NotNull; * * * + * This is enforced at runtime by occasional checks in {@link com.intellij.util.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 {@link StackOverflowError}, diff --git a/platform/core-impl/src/com/intellij/util/IdempotenceChecker.java b/platform/core-impl/src/com/intellij/util/IdempotenceChecker.java index 350f38be9e72..7655246a2afc 100644 --- a/platform/core-impl/src/com/intellij/util/IdempotenceChecker.java +++ b/platform/core-impl/src/com/intellij/util/IdempotenceChecker.java @@ -44,7 +44,7 @@ public class IdempotenceChecker { * {@code IdempotenceChecker.checkEquivalence()} for their results as well, localizing the error. *
  • * If it's a test, you could try reproducing and debugging it. To increase the probability of failure, - * you can temporarily add {@code Registry.getValue("platform.random.idempotence.check.rate").set(1, getTestRootDisposable())} + * you can temporarily add {@code Registry.getValue("platform.random.idempotence.check.rate").setValue(1, getTestRootDisposable())} * to perform the idempotence check on every cache access. Note that this can make your test much slower. *
  • *