diff --git a/platform/core-api/src/com/intellij/psi/util/CachedValueProvider.java b/platform/core-api/src/com/intellij/psi/util/CachedValueProvider.java index 7f3fe2651e05..4bb8cfa04068 100644 --- a/platform/core-api/src/com/intellij/psi/util/CachedValueProvider.java +++ b/platform/core-api/src/com/intellij/psi/util/CachedValueProvider.java @@ -1,7 +1,9 @@ // Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.psi.util; +import com.intellij.lang.Language; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.psi.PsiElement; import com.intellij.util.ArrayUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -10,8 +12,9 @@ import java.util.Collection; /** * A computation (typically a lambda) used by {@link CachedValue} to calculate a result and cache it. - * The provider should not have side effects and shouldn't depend on variables that change during the CachedValue lifetime. See - * {@link CachedValue} documentation for examples.
+ * The provider should not have side effects and shouldn't depend on variables that change during the CachedValue lifetime. + * See {@link CachedValue} documentation for examples. + * * @param+ * The state is remembered as a collection of {@code long} values representing some time stamps. + * Whenever changes occur, these stamps are incremented. + *
+ * Dependencies can be the following: *
+ * If your cached value uses a document instance as an input, you should use that document as a dependency.
+ * If it uses a PSI as an input, it should use that PSI as a dependency.
*
* @return the dependency items
- * @see com.intellij.openapi.util.ModificationTracker
+ * @see com.intellij.openapi.util.ModificationTracker ModificationTracker
* @see PsiModificationTracker
- * @see com.intellij.openapi.roots.ProjectRootModificationTracker
+ * @see com.intellij.openapi.roots.ProjectRootModificationTracker ProjectRootModificationTracker
+ * @see PsiModificationTracker#forLanguage(Language)
*/
public Object @NotNull [] getDependencyItems() {
return myDependencyItems;
@@ -77,6 +88,7 @@ public interface CachedValueProvider