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 949c050342ee..835659514ae2 100644 --- a/java/compiler/impl/src/com/intellij/compiler/backwardRefs/CompilerReferenceServiceBase.java +++ b/java/compiler/impl/src/com/intellij/compiler/backwardRefs/CompilerReferenceServiceBase.java @@ -23,7 +23,6 @@ import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ProjectFileIndex; import com.intellij.openapi.roots.ProjectRootManager; -import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.ModificationTracker; import com.intellij.openapi.util.ThrowableComputable; import com.intellij.openapi.vfs.VfsUtilCore; @@ -139,8 +138,6 @@ public abstract class CompilerReferenceServiceBase closeReaderIfNeeded(IndexCloseReason.SHUTDOWN)); } @Override @@ -672,7 +669,9 @@ public abstract class CompilerReferenceServiceBase T onException(@NotNull Exception e, @NotNull String actionName) { if (e instanceof ControlFlowException) { diff --git a/java/compiler/impl/src/com/intellij/compiler/backwardRefs/CompilerReferenceServiceImpl.java b/java/compiler/impl/src/com/intellij/compiler/backwardRefs/CompilerReferenceServiceImpl.java index d3167743c1b3..a4a95e66d827 100644 --- a/java/compiler/impl/src/com/intellij/compiler/backwardRefs/CompilerReferenceServiceImpl.java +++ b/java/compiler/impl/src/com/intellij/compiler/backwardRefs/CompilerReferenceServiceImpl.java @@ -14,7 +14,7 @@ import com.intellij.openapi.application.ReadAction; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.startup.StartupActivity; -import com.intellij.util.messages.SimpleMessageBusConnection; +import com.intellij.util.messages.MessageBusConnection; import it.unimi.dsi.fastutil.ints.IntSet; import one.util.streamex.StreamEx; import org.jetbrains.annotations.NotNull; @@ -38,7 +38,7 @@ public final class CompilerReferenceServiceImpl extends CompilerReferenceService } })); - SimpleMessageBusConnection connection = myProject.getMessageBus().simpleConnect(); + MessageBusConnection connection = project.getMessageBus().connect(this); connection.subscribe(BuildManagerListener.TOPIC, new BuildManagerListener() { @Override public void buildStarted(@NotNull Project project, @NotNull UUID sessionId, boolean isAutomake) { diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/MethodChainsCompletionTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/MethodChainsCompletionTest.java index 64fff4e8e213..19072fd87b42 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/MethodChainsCompletionTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/MethodChainsCompletionTest.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.java.codeInsight.completion; import com.intellij.JavaTestUtil; @@ -6,6 +6,7 @@ import com.intellij.codeInsight.CodeInsightSettings; import com.intellij.codeInsight.completion.CompletionType; import com.intellij.codeInsight.lookup.Lookup; import com.intellij.codeInsight.lookup.LookupElement; +import com.intellij.compiler.CompilerReferenceService; import com.intellij.compiler.chainsSearch.ChainRelevance; import com.intellij.compiler.chainsSearch.ChainSearchMagicConstants; import com.intellij.compiler.chainsSearch.completion.MethodChainCompletionContributor; @@ -37,6 +38,7 @@ public class MethodChainsCompletionTest extends AbstractCompilerAwareTest { myDefaultAutoCompleteOnCodeCompletion = CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_CODE_COMPLETION; CodeInsightSettings.getInstance().AUTOCOMPLETE_ON_SMART_TYPE_COMPLETION = false; LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_8); + CompilerReferenceService.getInstanceIfEnabled(getProject()); } @Override diff --git a/java/java-tests/testSrc/com/intellij/java/compiler/CompilerReferencesTestBase.java b/java/java-tests/testSrc/com/intellij/java/compiler/CompilerReferencesTestBase.java index a838c189ba1c..578c519174fc 100644 --- a/java/java-tests/testSrc/com/intellij/java/compiler/CompilerReferencesTestBase.java +++ b/java/java-tests/testSrc/com/intellij/java/compiler/CompilerReferencesTestBase.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2018 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.java.compiler; import com.intellij.compiler.CompilerReferenceService; @@ -26,6 +12,8 @@ public abstract class CompilerReferencesTestBase extends AbstractCompilerAwareTe myDefaultEnableState = CompilerReferenceService.IS_ENABLED_KEY.asBoolean(); CompilerReferenceService.IS_ENABLED_KEY.setValue(true); super.setUp(); + + CompilerReferenceService.getInstanceIfEnabled(getProject()); } @Override