fix CompilerReferencesTest

GitOrigin-RevId: d745272eba251417d23017a846f43f5c45207a48
This commit is contained in:
Vladimir Krivosheev
2021-12-27 07:29:54 +00:00
committed by intellij-monorepo-bot
parent 2a1f43a35e
commit 89a5a1d85e
4 changed files with 11 additions and 22 deletions
@@ -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<Reader extends CompilerRefere
}
});
}
Disposer.register(this, () -> closeReaderIfNeeded(IndexCloseReason.SHUTDOWN));
}
@Override
@@ -672,7 +669,9 @@ public abstract class CompilerReferenceServiceBase<Reader extends CompilerRefere
}
@Override
public void dispose() { }
public void dispose() {
closeReaderIfNeeded(IndexCloseReason.SHUTDOWN);
}
protected @Nullable <T> T onException(@NotNull Exception e, @NotNull String actionName) {
if (e instanceof ControlFlowException) {
@@ -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) {
@@ -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
@@ -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