IJPL-164584 Skip DUMB_EMPTY_INDEX with no dumb checks 2

GitOrigin-RevId: cf36a279eb8c57beb85fe4c82b7318678fb7ab0f
This commit is contained in:
Gregory.Shrago
2024-11-05 15:46:15 +00:00
committed by intellij-monorepo-bot
parent 9ed4985d76
commit 402acf04ff
8 changed files with 28 additions and 21 deletions
@@ -69,9 +69,7 @@ import com.intellij.openapi.fileTypes.PlainTextFileType;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.project.*;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.impl.JavaAwareProjectJdkTableImpl;
import com.intellij.openapi.util.Disposer;
@@ -1590,11 +1588,13 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase {
return new EditorBoundHighlightingPass(editor, psiFile, false) {
@Override
public void doCollectInformation(@NotNull ProgressIndicator progress) {
if (DumbService.isDumb(myProject)) throw IndexNotReadyException.create();
collected.add(SmartFac.this);
}
@Override
public void doApplyInformationToEditor() {
if (DumbService.isDumb(myProject)) return;
applied.add(SmartFac.this);
}
};
@@ -170,9 +170,11 @@ class LocalInspectionsInDumbModeTest : DaemonAnalyzerTestCase() {
"""
configureByText(JavaFileType.INSTANCE, text)
// dumb infos contain a redundant suppression because it's not removed as java suppressor does not work in dumb mode
val initialDumbInfos = doHighlightingInDumbMode().map { it.description }
assertDoesntContain(initialDumbInfos, "Redundant suppression")
if (Registry.`is`("ide.dumb.mode.check.awareness")) {
// dumb infos contain a redundant suppression because it's not removed as java suppressor does not work in dumb mode
val initialDumbInfos = doHighlightingInDumbMode().map { it.description }
assertDoesntContain(initialDumbInfos, "Redundant suppression")
}
// smart infos contain a redundant suppression, because suppression is in fact redundant,
// and redundant suppressor for Java works in smart mode
@@ -410,7 +410,9 @@ public class ParameterInfoTest extends AbstractParameterInfoTestCase {
"}";
myFixture.configureByText(JavaFileType.INSTANCE, text.replace("/*caret*/", "<caret>"));
assertEmpty(myFixture.doHighlighting(HighlightSeverity.ERROR));
if (!DumbService.isDumb(myFixture.getProject()) || Registry.is("ide.dumb.mode.check.awareness")) {
assertEmpty(myFixture.doHighlighting(HighlightSeverity.ERROR));
}
assertEquals("<html>Collection&lt;? super Object&gt; c, Object... elements</html>", parameterPresentation(-1));
}
@@ -15,12 +15,15 @@
*/
package com.intellij.java.codeInsight.template.postfix.templates;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.testFramework.IdeaTestUtil;
import com.intellij.testFramework.LightProjectDescriptor;
import org.jetbrains.annotations.NotNull;
public class StreamPostfixTemplateTest extends PostfixTemplateTestCase {
@Override
protected @NotNull LightProjectDescriptor getProjectDescriptor() {
return JAVA_8;
@@ -41,6 +44,11 @@ public class StreamPostfixTemplateTest extends PostfixTemplateTestCase {
}
public void testInLambda() {
if (DumbService.isDumb(myFixture.getProject()) &&
!Registry.is("ide.dumb.mode.check.awareness")) {
// See IDEA-362230
return;
}
doTest();
}
@@ -10,7 +10,6 @@ import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.ContentEntry;
import com.intellij.openapi.roots.LanguageLevelModuleExtension;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.pom.java.AcceptedLanguageLevelsSettings;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.*;
@@ -206,13 +205,7 @@ public abstract class LightJavaCodeInsightFixtureTestCase extends UsefulTestCase
@Override
public void setIndexingMode(@NotNull IndexingMode mode) {
if (Registry.is("ide.dumb.mode.check.awareness") ||
mode != IndexingMode.DUMB_EMPTY_INDEX) {
myIndexingMode = mode;
}
else {
myIndexingMode = IndexingMode.DUMB_FULL_INDEX;
}
myIndexingMode = mode;
}
@Override
@@ -155,6 +155,8 @@ public interface TestIndexingModeSupporter {
static void addTest(@NotNull Class<? extends TestIndexingModeSupporter> aClass,
@NotNull TestIndexingModeSupporter.IndexingModeTestHandler handler,
@NotNull TestSuite parentSuite) {
if (handler.getIndexingMode() == DUMB_EMPTY_INDEX &&
!Registry.is("ide.dumb.mode.check.awareness")) return;
if (handler.shouldIgnore(aClass)) return;
try {
TestSuite suite = handler.createTestSuite();
@@ -5,6 +5,7 @@ package org.jetbrains.kotlin.idea.test;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.testFramework.JUnit38AssumeSupportRunner;
import com.intellij.testFramework.TestIndexingModeSupporter;
import com.intellij.util.ArrayUtil;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestResult;
@@ -162,11 +163,7 @@ public class JUnit3RunnerWithInners extends Runner implements Filterable, Sortab
if (indexingMode != null) {
TestIndexingModeSupporter.@NotNull IndexingMode[] value = indexingMode.value();
if (!Registry.is("ide.dumb.mode.check.awareness")) {
for (int i = 0; i < value.length; i++) {
if (value[i] == TestIndexingModeSupporter.IndexingMode.DUMB_EMPTY_INDEX) {
value[i] = TestIndexingModeSupporter.IndexingMode.DUMB_FULL_INDEX;
}
}
return ArrayUtil.remove(value, TestIndexingModeSupporter.IndexingMode.DUMB_EMPTY_INDEX);
}
return value;
}
@@ -10,7 +10,9 @@ import com.intellij.openapi.editor.Document
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.colors.TextAttributesKey
import com.intellij.openapi.progress.ProcessCanceledException
import com.intellij.openapi.project.DumbService
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.registry.Registry
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiFile
import org.jetbrains.kotlin.checkers.utils.DebugInfoUtil
@@ -82,7 +84,8 @@ class DebugInfoHighlightingPass(file: KtFile, document: Document) : AbstractBind
// Temporary workaround to ignore red code in library sources
psiFile.shouldHighlightErrors() &&
(isUnitTestMode() || isApplicationInternalMode() && (KotlinIdePlugin.isSnapshot || KotlinIdePlugin.isDev)) &&
RootKindFilter.projectAndLibrarySources.matches(psiFile)
RootKindFilter.projectAndLibrarySources.matches(psiFile) &&
(!DumbService.isDumb(psiFile.project) || Registry.`is`("ide.dumb.mode.check.awareness"))
return if (useDebugInfoPass) DebugInfoHighlightingPass(psiFile as KtFile, editor.document) else null
}