mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
CachedValue/IdempotenceChecker javadoc: more links, fix code
This commit is contained in:
@@ -47,6 +47,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
* <li>Cached arrays or lists should have the same number of elements, and they also should be equivalent and come in the same order.</li>
|
||||
* <li>If the result object's class has a meaningful {@link #equals} method, it should hold.</li>
|
||||
* </ul>
|
||||
* 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.<p></p>
|
||||
*
|
||||
* <b>Context-independence</b>: 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;
|
||||
* </pre>
|
||||
* </ul>
|
||||
* </ul>
|
||||
* 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.<p></p>
|
||||
*
|
||||
* <b>Recursion prevention</b>: 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},
|
||||
|
||||
@@ -44,7 +44,7 @@ public class IdempotenceChecker {
|
||||
* {@code IdempotenceChecker.checkEquivalence()} for their results as well, localizing the error.</li>
|
||||
* <li>
|
||||
* 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.
|
||||
* </li>
|
||||
* </ul>
|
||||
|
||||
Reference in New Issue
Block a user