From 557b268ab441d172e01cbb5f12039fee03589f37 Mon Sep 17 00:00:00 2001 From: Dmitry Batkovich Date: Mon, 22 Mar 2021 18:45:35 +0300 Subject: [PATCH] java index: do not use project as disposable (service is used in scala plugin) GitOrigin-RevId: 207934507b707b5539312fe63befd40a9b16912a --- .../backwardRefs/CompilerReferenceServiceBase.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/java/compiler/impl/src/com/intellij/compiler/backwardRefs/CompilerReferenceServiceBase.java b/java/compiler/impl/src/com/intellij/compiler/backwardRefs/CompilerReferenceServiceBase.java index 9ade5e00347d..b61e13fc1086 100644 --- a/java/compiler/impl/src/com/intellij/compiler/backwardRefs/CompilerReferenceServiceBase.java +++ b/java/compiler/impl/src/com/intellij/compiler/backwardRefs/CompilerReferenceServiceBase.java @@ -8,6 +8,7 @@ import com.intellij.compiler.backwardRefs.view.CompilerReferenceHierarchyTestInf import com.intellij.compiler.backwardRefs.view.DirtyScopeTestInfo; import com.intellij.compiler.server.BuildManager; import com.intellij.lang.injection.InjectedLanguageManager; +import com.intellij.openapi.Disposable; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ReadAction; import com.intellij.openapi.compiler.CompileScope; @@ -67,7 +68,9 @@ import java.util.stream.Collectors; import static com.intellij.psi.search.GlobalSearchScope.getScopeRestrictedByFileTypes; import static com.intellij.psi.search.GlobalSearchScope.notScope; -public abstract class CompilerReferenceServiceBase> implements CompilerReferenceService, ModificationTracker { +public abstract class CompilerReferenceServiceBase> implements CompilerReferenceService, + ModificationTracker, + Disposable { private static final Logger LOG = Logger.getInstance(CompilerReferenceServiceBase.class); private final Set myFileTypes; @@ -98,7 +101,7 @@ public abstract class CompilerReferenceServiceBase closeReaderIfNeeded(IndexCloseReason.PROJECT_CLOSED)); + Disposer.register(this, () -> closeReaderIfNeeded(IndexCloseReason.PROJECT_CLOSED)); } @Nullable @@ -617,6 +620,9 @@ public abstract class CompilerReferenceServiceBase T onException(@NotNull Exception e, @NotNull String actionName) { if (e instanceof ControlFlowException) {