From 4ad78ae9b969bb092d103788ba9097d313fa47ac Mon Sep 17 00:00:00 2001 From: Tagir Valeev Date: Wed, 7 Feb 2024 11:35:35 +0100 Subject: [PATCH] Fix warnings GitOrigin-RevId: f6416c9263b26d60bf223a46127dac4d6af5951d --- .../codeInsight/daemon/impl/HighlightInfoUpdater.java | 2 +- .../codeInsight/daemon/impl/LocalInspectionsPass.java | 9 +-------- .../markdown/lang/psi/MarkdownPsiElementFactory.java | 8 ++------ 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfoUpdater.java b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfoUpdater.java index 7c6542b357f9..72a4129bcd8c 100644 --- a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfoUpdater.java +++ b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfoUpdater.java @@ -432,7 +432,7 @@ final class HighlightInfoUpdater { * We associate each HighlightInfo with the PSI element for which the inspection builder has produced that info. * Unfortunately, there are some crazy inspections that produce infos in their {@link LocalInspectionTool#inspectionFinished(LocalInspectionToolSession, ProblemsHolder)} method instead. * Which is very slow, because that highlight info won't be displayed until the entire file is visited. - * For these infos the associated PSI element is assumed to be this {@link #FAKE_ELEMENT} + * For these infos the associated PSI element is assumed to be this {@code FAKE_ELEMENT} */ static final PsiElement FAKE_ELEMENT = new PsiElement() { @Override diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPass.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPass.java index 98e3c9a57817..1b59f45783f4 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPass.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPass.java @@ -433,9 +433,6 @@ public final class LocalInspectionsPass extends ProgressableTextEditorHighlighti if (!isTests && !toolWrapper.isApplicable(projectTypes)) continue; - if (toolWrapper instanceof LocalInspectionToolWrapper local && !isAcceptableLocalTool(local)) { - continue; - } HighlightDisplayKey key = toolWrapper.getDisplayKey(); if (!profile.isToolEnabled(key, getFile())) continue; if (HighlightDisplayLevel.DO_NOT_SHOW.equals(profile.getErrorLevel(key, getFile()))) continue; @@ -445,7 +442,7 @@ public final class LocalInspectionsPass extends ProgressableTextEditorHighlighti } else { wrapper = ((GlobalInspectionToolWrapper)toolWrapper).getSharedLocalInspectionToolWrapper(); - if (wrapper == null || !isAcceptableLocalTool(wrapper)) continue; + if (wrapper == null) continue; } String language = wrapper.getLanguage(); if (language != null && Language.findLanguageByID(language) == null) { @@ -464,10 +461,6 @@ public final class LocalInspectionsPass extends ProgressableTextEditorHighlighti return enabled; } - protected boolean isAcceptableLocalTool(@NotNull LocalInspectionToolWrapper wrapper) { - return true; - } - @Override public @NotNull List getInfos() { return Collections.unmodifiableList(myInfos); diff --git a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/MarkdownPsiElementFactory.java b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/MarkdownPsiElementFactory.java index 9a8fbe149cf2..07bec255667b 100644 --- a/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/MarkdownPsiElementFactory.java +++ b/plugins/markdown/core/src/org/intellij/plugins/markdown/lang/psi/MarkdownPsiElementFactory.java @@ -127,12 +127,8 @@ public final class MarkdownPsiElementFactory { if (columnsCount < 1) { throw new IllegalArgumentException("Passed separator text should be valid and contain at least one column.\n Text passed: [" + text + "]"); } - final var builder = new StringBuilder(); - builder.append("|"); - builder.append(" |".repeat(columnsCount)); - builder.append('\n'); - builder.append(text); - final var file = createFile(project, builder.toString()); + String markdownFile = "|" + " |".repeat(columnsCount) + '\n' + text; + final var file = createFile(project, markdownFile); final var table = PsiTreeUtil.getParentOfType(file.findElementAt(0), MarkdownTable.class); if (table == null) { final var psi = DebugUtil.psiToString(file, true, true);