diff --git a/platform/core-impl/src/com/intellij/ide/plugins/PluginUtilImpl.java b/platform/core-impl/src/com/intellij/ide/plugins/PluginUtilImpl.java index 224e9c51cc16..79333a722335 100644 --- a/platform/core-impl/src/com/intellij/ide/plugins/PluginUtilImpl.java +++ b/platform/core-impl/src/com/intellij/ide/plugins/PluginUtilImpl.java @@ -1,4 +1,4 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide.plugins; import com.intellij.diagnostic.PluginException; @@ -126,9 +126,8 @@ public final class PluginUtilImpl implements PluginUtil { return causeId != null ? causeId : bundledId; } - @Nls @Override - public @Nullable String findPluginName(@NotNull PluginId pluginId) { + public @Nls @Nullable String findPluginName(@NotNull PluginId pluginId) { IdeaPluginDescriptor plugin = PluginManagerCore.getPlugin(pluginId); return plugin != null ? plugin.getName() : null; } diff --git a/plugins/htmltools/src/com/intellij/htmltools/codeInsight/daemon/impl/analysis/encoding/HtmlHttpEquivEncodingReferenceProvider.java b/plugins/htmltools/src/com/intellij/htmltools/codeInsight/daemon/impl/analysis/encoding/HtmlHttpEquivEncodingReferenceProvider.java index 061b9494e4a0..645e741595e9 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/codeInsight/daemon/impl/analysis/encoding/HtmlHttpEquivEncodingReferenceProvider.java +++ b/plugins/htmltools/src/com/intellij/htmltools/codeInsight/daemon/impl/analysis/encoding/HtmlHttpEquivEncodingReferenceProvider.java @@ -11,11 +11,11 @@ import com.intellij.util.ProcessingContext; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; -public class HtmlHttpEquivEncodingReferenceProvider extends XmlEncodingReferenceProvider { +public final class HtmlHttpEquivEncodingReferenceProvider extends XmlEncodingReferenceProvider { private static final Logger LOG = Logger.getInstance(XmlEncodingReferenceProvider.class); @Override - public PsiReference @NotNull [] getReferencesByElement(@NotNull PsiElement element, @NotNull final ProcessingContext context) { + public PsiReference @NotNull [] getReferencesByElement(@NotNull PsiElement element, final @NotNull ProcessingContext context) { LOG.assertTrue(element instanceof XmlAttributeValue); XmlAttributeValue value = (XmlAttributeValue)element; PsiElement parent = value.getParent(); diff --git a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/CreateRequiredSubElement.java b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/CreateRequiredSubElement.java index 4e5f1eeb9bff..2f0f260c3b80 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/CreateRequiredSubElement.java +++ b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/CreateRequiredSubElement.java @@ -10,24 +10,22 @@ import com.intellij.psi.xml.XmlTag; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class CreateRequiredSubElement extends LocalQuickFixAndIntentionActionOnPsiElement { +public final class CreateRequiredSubElement extends LocalQuickFixAndIntentionActionOnPsiElement { private final String myName; - protected CreateRequiredSubElement(@Nullable PsiElement element, String name) { + CreateRequiredSubElement(@Nullable PsiElement element, String name) { super(element); myName = name; } - @NotNull @Override - public String getText() { + public @NotNull String getText() { return HtmlToolsBundle.message("html.intention.create.sub.element.text", myName); } - @NotNull @Override - public String getFamilyName() { + public @NotNull String getFamilyName() { return HtmlToolsBundle.message("html.intention.create.sub.element.family", myName); } diff --git a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlDeprecatedAttributeInspection.java b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlDeprecatedAttributeInspection.java index 7d2fb1d24a98..977cbbcee16a 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlDeprecatedAttributeInspection.java +++ b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlDeprecatedAttributeInspection.java @@ -16,7 +16,7 @@ import org.jetbrains.annotations.NotNull; import static com.intellij.documentation.mdn.MdnDocumentationKt.getHtmlMdnDocumentation; import static com.intellij.webSymbols.WebSymbolApiStatus.isDeprecatedOrObsolete; -public class HtmlDeprecatedAttributeInspection extends HtmlLocalInspectionTool { +public final class HtmlDeprecatedAttributeInspection extends HtmlLocalInspectionTool { @Override protected void checkAttribute(@NotNull XmlAttribute attribute, @NotNull ProblemsHolder holder, boolean isOnTheFly) { diff --git a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlDeprecatedTagInspection.java b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlDeprecatedTagInspection.java index c2b3b328107c..5abdfbbee7d6 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlDeprecatedTagInspection.java +++ b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlDeprecatedTagInspection.java @@ -30,9 +30,9 @@ import java.util.Set; import static com.intellij.documentation.mdn.MdnDocumentationKt.getHtmlMdnDocumentation; import static com.intellij.webSymbols.WebSymbolApiStatus.isDeprecatedOrObsolete; -public class HtmlDeprecatedTagInspection extends HtmlLocalInspectionTool { - @NonNls private static final Set ourHtmlReplaceableTags; - @NonNls private static final Set ourCssReplaceableTags; +public final class HtmlDeprecatedTagInspection extends HtmlLocalInspectionTool { + private static final @NonNls Set ourHtmlReplaceableTags; + private static final @NonNls Set ourCssReplaceableTags; static { ourHtmlReplaceableTags = new HashSet<>(); @@ -61,7 +61,7 @@ public class HtmlDeprecatedTagInspection extends HtmlLocalInspectionTool { } @Override - protected void checkTag(@NotNull final XmlTag tag, @NotNull final ProblemsHolder holder, final boolean isOnTheFly) { + protected void checkTag(final @NotNull XmlTag tag, final @NotNull ProblemsHolder holder, final boolean isOnTheFly) { if (HtmlUtil.isHtmlTagContainingFile(tag)) { XmlElementDescriptor descriptor = tag.getDescriptor(); if (!(descriptor instanceof HtmlElementDescriptorImpl) || !((HtmlElementDescriptorImpl)descriptor).isDeprecated()) { diff --git a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlFormInputWithoutLabelInspection.java b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlFormInputWithoutLabelInspection.java index ddde82c83bab..c6ec6149bf2a 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlFormInputWithoutLabelInspection.java +++ b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlFormInputWithoutLabelInspection.java @@ -36,8 +36,7 @@ public final class HtmlFormInputWithoutLabelInspection extends HtmlLocalInspecti @Override - @NotNull - public String getShortName() { + public @NotNull String getShortName() { return "HtmlFormInputWithoutLabel"; } @@ -143,7 +142,7 @@ public final class HtmlFormInputWithoutLabelInspection extends HtmlLocalInspecti PsiElement getFirstChild(@NotNull PsiElement element); } - public static class ForwardIterator implements ElementIterator { + public static final class ForwardIterator implements ElementIterator { @Override public PsiElement getNext(PsiElement element) { return element.getNextSibling(); @@ -155,13 +154,12 @@ public final class HtmlFormInputWithoutLabelInspection extends HtmlLocalInspecti } @Override - @Nullable - public PsiElement getFirstChild(@NotNull PsiElement element) { + public @Nullable PsiElement getFirstChild(@NotNull PsiElement element) { return element.getFirstChild(); } } - public static class BackwardIterator implements ElementIterator { + public static final class BackwardIterator implements ElementIterator { @Override public PsiElement getNext(PsiElement element) { return element.getPrevSibling(); @@ -173,14 +171,12 @@ public final class HtmlFormInputWithoutLabelInspection extends HtmlLocalInspecti } @Override - @Nullable - public PsiElement getFirstChild(@NotNull PsiElement element) { + public @Nullable PsiElement getFirstChild(@NotNull PsiElement element) { return element.getLastChild(); } } - @Nullable - public static Pair getNearestText(PsiElement element, ElementIterator iterator) { + public static @Nullable Pair getNearestText(PsiElement element, ElementIterator iterator) { element = iterator.getNext(element); if (!(element instanceof XmlText) || element.getChildren().length == 0) { return null; diff --git a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlLabelsHolder.java b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlLabelsHolder.java index a25cadd7d41a..88e5e3d7b19b 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlLabelsHolder.java +++ b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlLabelsHolder.java @@ -17,11 +17,11 @@ import org.jetbrains.annotations.NotNull; import java.util.HashSet; import java.util.Set; -public class HtmlLabelsHolder { +public final class HtmlLabelsHolder { private static final Key> htmlLabelsHolderKey = Key.create("html labels holder"); private final Set myForValuesOfLabels = new HashSet<>(); - private final static UserDataCache, XmlFile, Object> CACHE = + private static final UserDataCache, XmlFile, Object> CACHE = new UserDataCache<>() { @Override protected CachedValue compute(final XmlFile file, final Object p) { diff --git a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlNonExistentInternetResourceInspection.java b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlNonExistentInternetResourceInspection.java index c676d7e51dcb..4f2ae188e80e 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlNonExistentInternetResourceInspection.java +++ b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlNonExistentInternetResourceInspection.java @@ -9,12 +9,11 @@ import org.jetbrains.annotations.NotNull; * This inspections is used to enable/disable checking internet links by external annotator * @see HtmlNonExistentInternetResourcesAnnotator */ -public class HtmlNonExistentInternetResourceInspection extends LocalInspectionTool { - @NonNls public static final String SHORT_NAME = "HtmlNonExistentInternetResource"; +public final class HtmlNonExistentInternetResourceInspection extends LocalInspectionTool { + public static final @NonNls String SHORT_NAME = "HtmlNonExistentInternetResource"; - @NotNull @Override - public String getShortName() { + public @NotNull String getShortName() { return SHORT_NAME; } } diff --git a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlPresentationalElementInspection.java b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlPresentationalElementInspection.java index 4f11ccbc73a3..91f2fb2b8fc1 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlPresentationalElementInspection.java +++ b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlPresentationalElementInspection.java @@ -14,10 +14,10 @@ import org.jetbrains.annotations.NotNull; import java.util.Set; -public class HtmlPresentationalElementInspection extends HtmlLocalInspectionTool { - @NonNls private static final Set ourCssReplaceableTags; - @NonNls private static final Set ourHtmlReplaceableTagsHtml4; - @NonNls private static final Set ourHtmlReplaceableTagsHtml5; +public final class HtmlPresentationalElementInspection extends HtmlLocalInspectionTool { + private static final @NonNls Set ourCssReplaceableTags; + private static final @NonNls Set ourHtmlReplaceableTagsHtml4; + private static final @NonNls Set ourHtmlReplaceableTagsHtml5; static { ourHtmlReplaceableTagsHtml4 = Set.of("i", "b", "tt"); @@ -26,13 +26,12 @@ public class HtmlPresentationalElementInspection extends HtmlLocalInspectionTool } @Override - @NotNull - public String getShortName() { + public @NotNull String getShortName() { return "HtmlPresentationalElement"; } @Override - protected void checkTag(@NotNull final XmlTag tag, @NotNull final ProblemsHolder holder, final boolean isOnTheFly) { + protected void checkTag(final @NotNull XmlTag tag, final @NotNull ProblemsHolder holder, final boolean isOnTheFly) { final String name = StringUtil.toLowerCase(tag.getName()); if (HtmlUtil.isHtmlTagContainingFile(tag)) { if (HtmlUtil.isHtml5Context(tag) && !ourHtmlReplaceableTagsHtml5.contains(tag.getName())) { diff --git a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlRequiredAltAttributeInspection.java b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlRequiredAltAttributeInspection.java index 64bdc39ae885..230c933ce3de 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlRequiredAltAttributeInspection.java +++ b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlRequiredAltAttributeInspection.java @@ -18,8 +18,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Set; -public class HtmlRequiredAltAttributeInspection extends HtmlLocalInspectionTool { - @NonNls private static final Set htmlTagsWithRequiredAltAttribute; +public final class HtmlRequiredAltAttributeInspection extends HtmlLocalInspectionTool { + private static final @NonNls Set htmlTagsWithRequiredAltAttribute; private static final String ALT = "alt"; static { @@ -50,9 +50,8 @@ public class HtmlRequiredAltAttributeInspection extends HtmlLocalInspectionTool ProblemHighlightType.GENERIC_ERROR_OR_WARNING); } - @NotNull @Override - public String getShortName() { + public @NotNull String getShortName() { return "HtmlRequiredAltAttribute"; } } diff --git a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlRequiredLangAttributeInspection.java b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlRequiredLangAttributeInspection.java index c00345207b4a..ee4217930df3 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlRequiredLangAttributeInspection.java +++ b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlRequiredLangAttributeInspection.java @@ -18,7 +18,7 @@ import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; -public class HtmlRequiredLangAttributeInspection extends HtmlLocalInspectionTool { +public final class HtmlRequiredLangAttributeInspection extends HtmlLocalInspectionTool { private static final String LANG = "lang"; private static final String HTML = "html"; @@ -60,9 +60,8 @@ public class HtmlRequiredLangAttributeInspection extends HtmlLocalInspectionTool ProblemHighlightType.GENERIC_ERROR_OR_WARNING); } - @NotNull @Override - public String getShortName() { + public @NotNull String getShortName() { return "HtmlRequiredLangAttribute"; } } diff --git a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlRequiredSummaryAttributeInspection.java b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlRequiredSummaryAttributeInspection.java index aec7d407d519..990a2830b9f1 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlRequiredSummaryAttributeInspection.java +++ b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlRequiredSummaryAttributeInspection.java @@ -14,7 +14,7 @@ import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; -public class HtmlRequiredSummaryAttributeInspection extends HtmlLocalInspectionTool { +public final class HtmlRequiredSummaryAttributeInspection extends HtmlLocalInspectionTool { private static final String TABLE = "table"; private static final String SUMMARY = "summary"; @@ -36,9 +36,8 @@ public class HtmlRequiredSummaryAttributeInspection extends HtmlLocalInspectionT ProblemHighlightType.GENERIC_ERROR_OR_WARNING); } - @NotNull @Override - public String getShortName() { + public @NotNull String getShortName() { return super.getShortName(); } } diff --git a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlRequiredTitleAttributeInspection.java b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlRequiredTitleAttributeInspection.java index 66dacf28b737..a2c1012398d9 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlRequiredTitleAttributeInspection.java +++ b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlRequiredTitleAttributeInspection.java @@ -17,7 +17,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Set; -public class HtmlRequiredTitleAttributeInspection extends HtmlLocalInspectionTool { +public final class HtmlRequiredTitleAttributeInspection extends HtmlLocalInspectionTool { private static final Set ourElementsWithoutTitle = Set.of("frame", "iframe", "dl", "a", "router-link"); private static final String TITLE = "title"; @@ -40,9 +40,8 @@ public class HtmlRequiredTitleAttributeInspection extends HtmlLocalInspectionToo } if (holder.isOnTheFly()) { fixes.add(new InsertRequiredAttributeFix(tag, TITLE) { - @NotNull @Override - public String getText() { + public @NotNull String getText() { return HtmlToolsBundle.message("html.intention.insert.attribute", TITLE); } }); @@ -52,9 +51,8 @@ public class HtmlRequiredTitleAttributeInspection extends HtmlLocalInspectionToo } } - @NotNull @Override - public String getShortName() { + public @NotNull String getShortName() { return "HtmlRequiredTitleAttribute"; } } diff --git a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlRequiredTitleElementInspection.java b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlRequiredTitleElementInspection.java index 526f779a3e9e..c3cebb993fba 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlRequiredTitleElementInspection.java +++ b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/HtmlRequiredTitleElementInspection.java @@ -14,7 +14,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public class HtmlRequiredTitleElementInspection extends HtmlLocalInspectionTool { +public final class HtmlRequiredTitleElementInspection extends HtmlLocalInspectionTool { private static final String TITLE = "title"; private static final String HEAD = "head"; @@ -33,9 +33,8 @@ public class HtmlRequiredTitleElementInspection extends HtmlLocalInspectionTool ProblemHighlightType.GENERIC_ERROR_OR_WARNING); } - @NotNull @Override - public String getShortName() { + public @NotNull String getShortName() { return "HtmlRequiredTitleElement"; } } diff --git a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/htmlAddLabelToForm/CreateLabelFromTextAction.java b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/htmlAddLabelToForm/CreateLabelFromTextAction.java index 035ab9e86718..a7d32e7235f1 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/htmlAddLabelToForm/CreateLabelFromTextAction.java +++ b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/htmlAddLabelToForm/CreateLabelFromTextAction.java @@ -16,7 +16,7 @@ import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.PropertyKey; -public class CreateLabelFromTextAction implements LocalQuickFix, HighPriorityAction { +public final class CreateLabelFromTextAction implements LocalQuickFix, HighPriorityAction { private final String myBundleKey; private final boolean myTextBeforeTag; private final String myName; @@ -29,8 +29,7 @@ public class CreateLabelFromTextAction implements LocalQuickFix, HighPriorityAct } @Override - @NotNull - public String getFamilyName() { + public @NotNull String getFamilyName() { return HtmlToolsBundle.message(myBundleKey, myName); } diff --git a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/htmlAddLabelToForm/CreateNewLabelAction.java b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/htmlAddLabelToForm/CreateNewLabelAction.java index c70aae9907aa..2a4b1a071fda 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/htmlAddLabelToForm/CreateNewLabelAction.java +++ b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/htmlAddLabelToForm/CreateNewLabelAction.java @@ -15,7 +15,7 @@ import com.intellij.xml.util.XmlUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class CreateNewLabelAction implements LocalQuickFix, HighPriorityAction { +public final class CreateNewLabelAction implements LocalQuickFix, HighPriorityAction { private final String myName; public CreateNewLabelAction(String name) { @@ -23,8 +23,7 @@ public class CreateNewLabelAction implements LocalQuickFix, HighPriorityAction { } @Override - @NotNull - public String getFamilyName() { + public @NotNull String getFamilyName() { return HtmlToolsBundle.message("html.inspections.create.new.label", myName); } @@ -52,8 +51,7 @@ public class CreateNewLabelAction implements LocalQuickFix, HighPriorityAction { } } - @NotNull - private static XmlTag createLabelFor(@NotNull XmlTag place, @NotNull XmlAttributeValue id) { + private static @NotNull XmlTag createLabelFor(@NotNull XmlTag place, @NotNull XmlAttributeValue id) { XmlTag tag = createElementFromText(place.getProject(), place, ""); //noinspection ConstantConditions tag.getAttribute("for").getValueElement().replace(id); @@ -64,14 +62,12 @@ public class CreateNewLabelAction implements LocalQuickFix, HighPriorityAction { return XmlElementFactory.getInstance(project).createTagFromText("\n").getValue().getTextElements()[0]; } - @Nullable - static String getId(XmlTag tag) { + static @Nullable String getId(XmlTag tag) { XmlAttributeValue value = findIdValue(tag); return value == null ? null : value.getValue(); } - @Nullable - private static XmlAttributeValue findIdValue(XmlTag tag) { + private static @Nullable XmlAttributeValue findIdValue(XmlTag tag) { for (XmlAttribute attribute : tag.getAttributes()) { if (attribute.getName().equalsIgnoreCase("id")) { return attribute.getValueElement(); @@ -80,8 +76,7 @@ public class CreateNewLabelAction implements LocalQuickFix, HighPriorityAction { return null; } - @NotNull - static XmlTag createElementFromText(Project project, XmlTag myTag, String text) { + static @NotNull XmlTag createElementFromText(Project project, XmlTag myTag, String text) { return myTag instanceof HtmlTag ? XmlElementFactory.getInstance(project).createHTMLTagFromText(text) : XmlElementFactory.getInstance(project).createXHTMLTagFromText(text); diff --git a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/htmltagreplace/ReplaceAppletTagAction.java b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/htmltagreplace/ReplaceAppletTagAction.java index 51dc9985d453..dd4765fadea1 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/htmltagreplace/ReplaceAppletTagAction.java +++ b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/htmltagreplace/ReplaceAppletTagAction.java @@ -15,9 +15,9 @@ import java.util.Arrays; import java.util.HashSet; import java.util.Set; -public class ReplaceAppletTagAction implements LocalQuickFix { - private static class Holder { - @NonNls private static final Set ourObjectAttributes = new HashSet<>(); +public final class ReplaceAppletTagAction implements LocalQuickFix { + private static final class Holder { + private static final @NonNls Set ourObjectAttributes = new HashSet<>(); static { ourObjectAttributes.addAll(Arrays.asList("align", "height", "hspace", "title", "vspace", "width")); @@ -25,15 +25,12 @@ public class ReplaceAppletTagAction implements LocalQuickFix { } @Override - @NotNull - public String getName() { + public @NotNull String getName() { return HtmlToolsBundle.message("html.replace.tag.with.another.quickfix.text", "applet", "object"); } @Override - @NonNls - @NotNull - public String getFamilyName() { + public @NonNls @NotNull String getFamilyName() { return "ReplaceDeprecatedTag"; } @@ -44,7 +41,7 @@ public class ReplaceAppletTagAction implements LocalQuickFix { } @Override - public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) { + public void applyFix(final @NotNull Project project, final @NotNull ProblemDescriptor descriptor) { PsiElement parent = descriptor.getPsiElement(); while (parent != null) { if (parent instanceof XmlTag && "applet".equals(StringUtil.toLowerCase(((XmlTag)parent).getLocalName()))) { diff --git a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/htmltagreplace/ReplaceFontTagAction.java b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/htmltagreplace/ReplaceFontTagAction.java index 4f436a27d655..3f2fe8ded5c5 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/htmltagreplace/ReplaceFontTagAction.java +++ b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/htmltagreplace/ReplaceFontTagAction.java @@ -15,9 +15,9 @@ import org.jetbrains.annotations.NotNull; import java.util.HashMap; import java.util.Map; -public class ReplaceFontTagAction implements LocalQuickFix { - private static class Holder { - @NonNls private static final Map ourSizesMap = new HashMap<>(); +public final class ReplaceFontTagAction implements LocalQuickFix { + private static final class Holder { + private static final @NonNls Map ourSizesMap = new HashMap<>(); static { ourSizesMap.put("-3", "59%"); @@ -38,15 +38,12 @@ public class ReplaceFontTagAction implements LocalQuickFix { } @Override - @NotNull - public String getName() { + public @NotNull String getName() { return HtmlToolsBundle.message("html.replace.tag.with.css.quickfix.text", "font"); } @Override - @NonNls - @NotNull - public String getFamilyName() { + public @NonNls @NotNull String getFamilyName() { return "ReplaceDepracatedTag"; } @@ -57,7 +54,7 @@ public class ReplaceFontTagAction implements LocalQuickFix { } @Override - public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) { + public void applyFix(final @NotNull Project project, final @NotNull ProblemDescriptor descriptor) { PsiElement parent = descriptor.getPsiElement(); while (parent != null) { if (parent instanceof XmlTag && "font".equals(StringUtil.toLowerCase(((XmlTag)parent).getLocalName()))) { diff --git a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/htmltagreplace/ReplaceHtmlTagWithAnotherAction.java b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/htmltagreplace/ReplaceHtmlTagWithAnotherAction.java index 02df58f93676..905d09ec4a79 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/htmltagreplace/ReplaceHtmlTagWithAnotherAction.java +++ b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/htmltagreplace/ReplaceHtmlTagWithAnotherAction.java @@ -17,14 +17,14 @@ import org.jetbrains.annotations.NotNull; import java.util.HashMap; import java.util.Map; -public class ReplaceHtmlTagWithAnotherAction implements LocalQuickFix { - @NonNls private final String myName; +public final class ReplaceHtmlTagWithAnotherAction implements LocalQuickFix { + private final @NonNls String myName; public ReplaceHtmlTagWithAnotherAction(String name) { myName = name; } - private static class Holder { - @NonNls private static final Map ourTagToNewTagMap = new HashMap<>(); + private static final class Holder { + private static final @NonNls Map ourTagToNewTagMap = new HashMap<>(); static { ourTagToNewTagMap.put("i", "em"); @@ -39,15 +39,12 @@ public class ReplaceHtmlTagWithAnotherAction implements LocalQuickFix { } @Override - @NotNull - public String getName() { + public @NotNull String getName() { return HtmlToolsBundle.message("html.replace.tag.with.another.quickfix.text", myName, Holder.ourTagToNewTagMap.get(myName)); } @Override - @NonNls - @NotNull - public String getFamilyName() { + public @NonNls @NotNull String getFamilyName() { return HtmlToolsBundle.message("html.replace.tag.with.another.quickfix.family.name"); } @@ -58,7 +55,7 @@ public class ReplaceHtmlTagWithAnotherAction implements LocalQuickFix { } @Override - public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) { + public void applyFix(final @NotNull Project project, final @NotNull ProblemDescriptor descriptor) { PsiElement parent = descriptor.getPsiElement(); while (parent != null) { if (parent instanceof XmlTag && myName.equals(StringUtil.toLowerCase(((XmlTag)parent).getLocalName()))) { diff --git a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/htmltagreplace/ReplaceHtmlTagWithCssAction.java b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/htmltagreplace/ReplaceHtmlTagWithCssAction.java index e1d1b2f111ab..a09e34a55e94 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/htmltagreplace/ReplaceHtmlTagWithCssAction.java +++ b/plugins/htmltools/src/com/intellij/htmltools/codeInspection/htmlInspections/htmltagreplace/ReplaceHtmlTagWithCssAction.java @@ -16,15 +16,15 @@ import org.jetbrains.annotations.NotNull; import java.util.HashMap; import java.util.Map; -public class ReplaceHtmlTagWithCssAction implements LocalQuickFix { - @NonNls private final String myName; +public final class ReplaceHtmlTagWithCssAction implements LocalQuickFix { + private final @NonNls String myName; - @NonNls private static final String BODY = "body"; - @NonNls private static final String HTML = "html"; - @NonNls private static final String HEAD = "head"; + private static final @NonNls String BODY = "body"; + private static final @NonNls String HTML = "html"; + private static final @NonNls String HEAD = "head"; - private static class Holder { - @NonNls private static final Map ourTagToCssMap = new HashMap<>(); + private static final class Holder { + private static final @NonNls Map ourTagToCssMap = new HashMap<>(); static { ourTagToCssMap.put("center", "text-align: center;"); @@ -45,20 +45,16 @@ public class ReplaceHtmlTagWithCssAction implements LocalQuickFix { } @Override - @NotNull - public String getName() { + public @NotNull String getName() { return HtmlToolsBundle.message("html.replace.tag.with.css.quickfix.text", myName); } - @NotNull - public String getText() { + public @NotNull String getText() { return getName(); } @Override - @NonNls - @NotNull - public String getFamilyName() { + public @NonNls @NotNull String getFamilyName() { return HtmlToolsBundle.message("html.replace.tag.with.css.quickfix.family.name"); } @@ -90,7 +86,7 @@ public class ReplaceHtmlTagWithCssAction implements LocalQuickFix { } @Override - public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) { + public void applyFix(final @NotNull Project project, final @NotNull ProblemDescriptor descriptor) { PsiElement parent = descriptor.getPsiElement(); while (parent != null) { if (parent instanceof XmlTag && Holder.ourTagToCssMap.containsKey(StringUtil.toLowerCase(((XmlTag)parent).getLocalName()))) { diff --git a/plugins/htmltools/src/com/intellij/htmltools/html/HtmlGotoSymbolProvider.java b/plugins/htmltools/src/com/intellij/htmltools/html/HtmlGotoSymbolProvider.java index 7cabbc7d56d1..61b9d1755ab6 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/html/HtmlGotoSymbolProvider.java +++ b/plugins/htmltools/src/com/intellij/htmltools/html/HtmlGotoSymbolProvider.java @@ -22,7 +22,7 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.util.Objects; -public class HtmlGotoSymbolProvider implements ChooseByNameContributorEx { +public final class HtmlGotoSymbolProvider implements ChooseByNameContributorEx { @Override public void processNames(@NotNull Processor processor, @NotNull GlobalSearchScope scope, @Nullable IdFilter filter) { FileBasedIndex.getInstance().processAllKeys(HtmlTagIdIndex.INDEX, (name) -> processor.process(name) && processor.process("#" + name), @@ -79,9 +79,8 @@ public class HtmlGotoSymbolProvider implements ChooseByNameContributorEx { return myName; } - @Nullable @Override - public String getLocationString() { + public @Nullable String getLocationString() { PsiFile psiFile = PsiManager.getInstance(myProject).findFile(myFile); return psiFile != null ? "(" + SymbolPresentationUtil.getFilePathPresentation(psiFile) + ")" : null; } diff --git a/plugins/htmltools/src/com/intellij/htmltools/html/HtmlTagIdIndex.java b/plugins/htmltools/src/com/intellij/htmltools/html/HtmlTagIdIndex.java index f77065f1c41d..b35e9f28d1cc 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/html/HtmlTagIdIndex.java +++ b/plugins/htmltools/src/com/intellij/htmltools/html/HtmlTagIdIndex.java @@ -26,18 +26,16 @@ import java.util.Map; import static com.intellij.util.indexing.hints.FileTypeSubstitutionStrategy.BEFORE_SUBSTITUTION; -public class HtmlTagIdIndex extends XmlIndex { +public final class HtmlTagIdIndex extends XmlIndex { public static final ID INDEX = ID.create("HtmlTagIdIndex"); - @NotNull @Override - public ID getName() { + public @NotNull ID getName() { return INDEX; } - @NotNull @Override - public FileBasedIndex.InputFilter getInputFilter() { + public @NotNull FileBasedIndex.InputFilter getInputFilter() { return new BaseFileTypeInputFilter(BEFORE_SUBSTITUTION) { @Override public boolean slowPathIfFileTypeHintUnsure(@NotNull IndexedFile file) { @@ -57,13 +55,11 @@ public class HtmlTagIdIndex extends XmlIndex { }; } - @NotNull @Override - public DataIndexer getIndexer() { + public @NotNull DataIndexer getIndexer() { return new DataIndexer<>() { - @NotNull @Override - public Map map(@NotNull FileContent inputData) { + public @NotNull Map map(@NotNull FileContent inputData) { Map result = new HashMap<>(); inputData .getPsiFile() @@ -98,9 +94,8 @@ public class HtmlTagIdIndex extends XmlIndex { return 3; } - @NotNull @Override - public DataExternalizer getValueExternalizer() { + public @NotNull DataExternalizer getValueExternalizer() { return new DataExternalizer<>() { @Override public void save(@NotNull DataOutput out, Integer value) throws IOException { diff --git a/plugins/htmltools/src/com/intellij/htmltools/html/actions/TableCellNavigator.java b/plugins/htmltools/src/com/intellij/htmltools/html/actions/TableCellNavigator.java index 708ccd15252f..417a58e354c5 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/html/actions/TableCellNavigator.java +++ b/plugins/htmltools/src/com/intellij/htmltools/html/actions/TableCellNavigator.java @@ -28,7 +28,7 @@ public final class TableCellNavigator { return row >= 0 && row < table.size() && column >= 0 && column < table.get(row).size(); } - public static void moveCaret(@NotNull final Project project,@NotNull final Editor editor, final PsiFile file, int[] direction) { + public static void moveCaret(final @NotNull Project project, final @NotNull Editor editor, final PsiFile file, int[] direction) { PsiElement element = getCurrentPsiElement(editor, file); element = getParentWithName(element, new String[]{TD, TH}); assert element != null; diff --git a/plugins/htmltools/src/com/intellij/htmltools/html/actions/TableColumnAdder.java b/plugins/htmltools/src/com/intellij/htmltools/html/actions/TableColumnAdder.java index abceeda72477..2946c9b605c5 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/html/actions/TableColumnAdder.java +++ b/plugins/htmltools/src/com/intellij/htmltools/html/actions/TableColumnAdder.java @@ -34,7 +34,7 @@ public final class TableColumnAdder { } } - private static void addColumnToTable(@NotNull final Project project, List table, int columnNumber) { + private static void addColumnToTable(final @NotNull Project project, List table, int columnNumber) { for (int i = 0; i < table.size(); i++) { TableRow row = table.get(i); if (row.isEmpty()) { @@ -111,7 +111,7 @@ public final class TableColumnAdder { return false; } - public static void addColumn(@NotNull final Project project, final Editor editor, final PsiFile file, boolean toInsertBefore) + public static void addColumn(final @NotNull Project project, final Editor editor, final PsiFile file, boolean toInsertBefore) throws IncorrectOperationException { PsiElement element = getCurrentPsiElement(editor, file); element = getParentWithName(element, new String[]{TD, TH}); diff --git a/plugins/htmltools/src/com/intellij/htmltools/html/actions/TableUtil.java b/plugins/htmltools/src/com/intellij/htmltools/html/actions/TableUtil.java index bbc69d4178d9..9d3108fef8ec 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/html/actions/TableUtil.java +++ b/plugins/htmltools/src/com/intellij/htmltools/html/actions/TableUtil.java @@ -19,16 +19,15 @@ import java.util.ArrayList; import java.util.List; public final class TableUtil { - @NonNls static final String TD = "td"; - @NonNls static final String TH = "th"; - @NonNls static final String TR = "tr"; - @NonNls static final String TABLE = "table"; - @NonNls static final String COLSPAN = "colspan"; - @NonNls static final String ROWSPAN = "rowspan"; - @NonNls static final String THEAD = "thead"; + static final @NonNls String TD = "td"; + static final @NonNls String TH = "th"; + static final @NonNls String TR = "tr"; + static final @NonNls String TABLE = "table"; + static final @NonNls String COLSPAN = "colspan"; + static final @NonNls String ROWSPAN = "rowspan"; + static final @NonNls String THEAD = "thead"; - @Nullable - static PsiElement getParentWithName(PsiElement element, String[] tagNames) { + static @Nullable PsiElement getParentWithName(PsiElement element, String[] tagNames) { while (element != null) { if (element instanceof XmlTag) { if (tagNames != null) { @@ -196,23 +195,20 @@ public final class TableUtil { return Pair.create(table, cell); } - @Nullable - static PsiElement getCurrentPsiElement(final Editor editor, final PsiFile file) { + static @Nullable PsiElement getCurrentPsiElement(final Editor editor, final PsiFile file) { final int offset = editor.getCaretModel().getOffset(); final PsiElement psiElement = file.findElementAt(offset); return PsiTreeUtil.getParentOfType(psiElement, XmlTag.class); } - @Nullable - static PsiElement getTablePsiElement(PsiElement root) { + static @Nullable PsiElement getTablePsiElement(PsiElement root) { while (root != null && !(root instanceof XmlTag && TABLE.equals(StringUtil.toLowerCase(((XmlTag)root).getName())))) { root = root.getParent(); } return root; } - @Nullable - static PsiElement findClosingToken(XmlTag tag) { + static @Nullable PsiElement findClosingToken(XmlTag tag) { PsiElement[] children = tag.getChildren(); for (int i = 0; i < children.length; i++) { PsiElement element = children[i]; @@ -226,7 +222,7 @@ public final class TableUtil { return null; } - static void moveCaretTo(@NotNull final Editor editor, final PsiElement element) { + static void moveCaretTo(final @NotNull Editor editor, final PsiElement element) { editor.getCaretModel().moveToOffset(element.getTextOffset()); editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE); } @@ -240,7 +236,7 @@ public final class TableUtil { return HtmlUtil.isHtmlTagContainingFile(element); } - static class TableCell { + static final class TableCell { final int startColumn; final int startRow; final int cols; @@ -264,7 +260,7 @@ public final class TableUtil { } } - static class TableRow { + static final class TableRow { final XmlTag rowTag; final List list; final boolean insideHeader; diff --git a/plugins/htmltools/src/com/intellij/htmltools/html/include/HtmlFileIncludeProvider.java b/plugins/htmltools/src/com/intellij/htmltools/html/include/HtmlFileIncludeProvider.java index f86acb5c2fc2..f4abdb836513 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/html/include/HtmlFileIncludeProvider.java +++ b/plugins/htmltools/src/com/intellij/htmltools/html/include/HtmlFileIncludeProvider.java @@ -14,10 +14,9 @@ import com.intellij.util.indexing.FileContent; import com.intellij.xml.util.HtmlUtil; import org.jetbrains.annotations.NotNull; -public class HtmlFileIncludeProvider extends FileIncludeProvider { - @NotNull +public final class HtmlFileIncludeProvider extends FileIncludeProvider { @Override - public String getId() { + public @NotNull String getId() { return "html"; } diff --git a/plugins/htmltools/src/com/intellij/htmltools/ide/HtmlFileDropHandler.java b/plugins/htmltools/src/com/intellij/htmltools/ide/HtmlFileDropHandler.java index 4c8108c37186..b74dac51aab9 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/ide/HtmlFileDropHandler.java +++ b/plugins/htmltools/src/com/intellij/htmltools/ide/HtmlFileDropHandler.java @@ -57,7 +57,7 @@ import java.util.List; /** * @author Dennis.Ushakov */ -public class HtmlFileDropHandler extends CustomFileDropHandler { +public final class HtmlFileDropHandler extends CustomFileDropHandler { @Override public boolean canHandle(@NotNull Transferable t, @Nullable Editor editor) { if (editor == null) return false; @@ -190,8 +190,7 @@ public class HtmlFileDropHandler extends CustomFileDropHandler { return true; } - @Nullable - private static String prepareTagText(HtmlFileImpl target, String tagTemplate, String path) { + private static @Nullable String prepareTagText(HtmlFileImpl target, String tagTemplate, String path) { return path != null ? MessageFormat.format(tagTemplate, XmlEditUtil.getAttributeQuote(target), path) : null; } @@ -200,8 +199,7 @@ public class HtmlFileDropHandler extends CustomFileDropHandler { return FileUtil.getRelativePath(targetFile.getParent().getPath(), droppedFile.getPath(), '/'); } - @Nullable - private static VirtualFile getDroppedFile(@NotNull Transferable t) { + private static @Nullable VirtualFile getDroppedFile(@NotNull Transferable t) { List list = FileCopyPasteUtil.getFileList(t); final File io = list != null && list.size() == 1 ? ContainerUtil.getFirstItem(list) : null; return io != null ? VfsUtil.findFileByIoFile(io, true) : null; diff --git a/plugins/htmltools/src/com/intellij/htmltools/ide/browsers/actions/WebOpenInAction.java b/plugins/htmltools/src/com/intellij/htmltools/ide/browsers/actions/WebOpenInAction.java index a182a6cff230..77e08ba08009 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/ide/browsers/actions/WebOpenInAction.java +++ b/plugins/htmltools/src/com/intellij/htmltools/ide/browsers/actions/WebOpenInAction.java @@ -11,7 +11,7 @@ import com.intellij.ui.popup.PopupFactoryImpl; import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; -public class WebOpenInAction extends DumbAwareAction { +public final class WebOpenInAction extends DumbAwareAction { @Override public @NotNull ActionUpdateThread getActionUpdateThread() { @@ -19,7 +19,7 @@ public class WebOpenInAction extends DumbAwareAction { } @Override - public void actionPerformed(@NotNull final AnActionEvent e) { + public void actionPerformed(final @NotNull AnActionEvent e) { DataContext dataContext = e.getDataContext(); ActionGroup group = getGroup(); ListPopup popup = JBPopupFactory.getInstance() diff --git a/plugins/htmltools/src/com/intellij/htmltools/lang/annotation/HtmlNonExistentInternetResourcesAnnotator.java b/plugins/htmltools/src/com/intellij/htmltools/lang/annotation/HtmlNonExistentInternetResourcesAnnotator.java index d3ad6e41cd17..01a04faf22a0 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/lang/annotation/HtmlNonExistentInternetResourcesAnnotator.java +++ b/plugins/htmltools/src/com/intellij/htmltools/lang/annotation/HtmlNonExistentInternetResourcesAnnotator.java @@ -24,7 +24,7 @@ import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; -public class HtmlNonExistentInternetResourcesAnnotator extends WebReferencesAnnotatorBase { +public final class HtmlNonExistentInternetResourcesAnnotator extends WebReferencesAnnotatorBase { public static boolean ourEnableInTestMode = false; @Override @@ -58,8 +58,7 @@ public class HtmlNonExistentInternetResourcesAnnotator extends WebReferencesAnno return result.toArray(new WebReference[0]); } - @Nullable - public static HtmlNonExistentInternetResourceInspection getInspection(@NotNull PsiElement context) { + public static @Nullable HtmlNonExistentInternetResourceInspection getInspection(@NotNull PsiElement context) { final String shortName = HtmlNonExistentInternetResourceInspection.SHORT_NAME; final HighlightDisplayKey key = HighlightDisplayKey.find(shortName); @@ -79,18 +78,16 @@ public class HtmlNonExistentInternetResourcesAnnotator extends WebReferencesAnno return new IntentionAction[] {new MyDisableInspectionFix()}; } - @NotNull @Override - protected HighlightDisplayLevel getHighlightDisplayLevel(@NotNull PsiElement context) { + protected @NotNull HighlightDisplayLevel getHighlightDisplayLevel(@NotNull PsiElement context) { final InspectionProfile inspectionProfile = InspectionProjectProfileManager.getInstance(context.getProject()).getCurrentProfile(); final HighlightDisplayKey displayKey = HighlightDisplayKey.find(HtmlNonExistentInternetResourceInspection.SHORT_NAME); return inspectionProfile.getErrorLevel(displayKey, context); } - @NotNull @Override - protected String getErrorMessage(@NotNull String url) { + protected @NotNull String getErrorMessage(@NotNull String url) { return HtmlToolsBundle.message("html.inspections.non.existent.internet.resource.message", url); } @@ -103,15 +100,13 @@ public class HtmlNonExistentInternetResourcesAnnotator extends WebReferencesAnno myDisableInspectionToolAction = new DisableInspectionToolAction(key); } - @NotNull @Override - public String getText() { + public @NotNull String getText() { return HtmlToolsBundle.message("html.intention.disable.validation.web.links"); } - @NotNull @Override - public String getFamilyName() { + public @NotNull String getFamilyName() { return getText(); } @@ -125,9 +120,8 @@ public class HtmlNonExistentInternetResourcesAnnotator extends WebReferencesAnno myDisableInspectionToolAction.invoke(project, editor, file); } - @Nullable @Override - public PsiElement getElementToMakeWritable(@NotNull PsiFile file) { + public @Nullable PsiElement getElementToMakeWritable(@NotNull PsiFile file) { return myDisableInspectionToolAction.getElementToMakeWritable(file); } diff --git a/plugins/htmltools/src/com/intellij/htmltools/refactoring/lang/html/ExtractIncludeFromHTMLHandler.java b/plugins/htmltools/src/com/intellij/htmltools/refactoring/lang/html/ExtractIncludeFromHTMLHandler.java index 43fcc0631eed..90be8e28897e 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/refactoring/lang/html/ExtractIncludeFromHTMLHandler.java +++ b/plugins/htmltools/src/com/intellij/htmltools/refactoring/lang/html/ExtractIncludeFromHTMLHandler.java @@ -19,7 +19,7 @@ import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class ExtractIncludeFromHTMLHandler extends ExtractIncludeFileBase { +public final class ExtractIncludeFromHTMLHandler extends ExtractIncludeFileBase { private static final Logger LOG = Logger.getInstance(ExtractIncludeFromHTMLHandler.class); @Override @@ -36,7 +36,7 @@ public class ExtractIncludeFromHTMLHandler extends ExtractIncludeFileBase findPairToExtract(final int start, final int end) { + protected @Nullable Pair findPairToExtract(final int start, final int end) { Pair range = XmlUtil.findTagChildrenInRange(myIncludingFile, start, end); if (range != null) { if (range.first == range.second && range.first instanceof XmlTag) { diff --git a/plugins/htmltools/src/com/intellij/htmltools/xml/actions/HtmlAddTableColumnAfterAction.java b/plugins/htmltools/src/com/intellij/htmltools/xml/actions/HtmlAddTableColumnAfterAction.java index 2aab2454fef2..edb44056c7dc 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/xml/actions/HtmlAddTableColumnAfterAction.java +++ b/plugins/htmltools/src/com/intellij/htmltools/xml/actions/HtmlAddTableColumnAfterAction.java @@ -8,25 +8,24 @@ import com.intellij.openapi.project.Project; import com.intellij.psi.PsiFile; import org.jetbrains.annotations.NotNull; -public class HtmlAddTableColumnAfterAction extends CodeInsightAction { +public final class HtmlAddTableColumnAfterAction extends CodeInsightAction { private final CodeInsightActionHandler myHandler; public HtmlAddTableColumnAfterAction() { myHandler = new CodeInsightActionHandler() { @Override - public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) { + public void invoke(final @NotNull Project project, final @NotNull Editor editor, final @NotNull PsiFile file) { TableColumnAdder.addColumn(project, editor, file, false); } }; } @Override - @NotNull - protected final CodeInsightActionHandler getHandler() { + protected final @NotNull CodeInsightActionHandler getHandler() { return myHandler; } @Override - public boolean isValidForFile(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) { + public boolean isValidForFile(final @NotNull Project project, final @NotNull Editor editor, final @NotNull PsiFile file) { return TableColumnAdder.isActionAvailable(editor, file); } } diff --git a/plugins/htmltools/src/com/intellij/htmltools/xml/actions/HtmlAddTableColumnBeforeAction.java b/plugins/htmltools/src/com/intellij/htmltools/xml/actions/HtmlAddTableColumnBeforeAction.java index aaeb151b1903..b217bab0f95f 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/xml/actions/HtmlAddTableColumnBeforeAction.java +++ b/plugins/htmltools/src/com/intellij/htmltools/xml/actions/HtmlAddTableColumnBeforeAction.java @@ -8,26 +8,25 @@ import com.intellij.openapi.project.Project; import com.intellij.psi.PsiFile; import org.jetbrains.annotations.NotNull; -public class HtmlAddTableColumnBeforeAction extends CodeInsightAction { +public final class HtmlAddTableColumnBeforeAction extends CodeInsightAction { private final CodeInsightActionHandler myHandler; public HtmlAddTableColumnBeforeAction() { myHandler = new CodeInsightActionHandler() { @Override - public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) { + public void invoke(final @NotNull Project project, final @NotNull Editor editor, final @NotNull PsiFile file) { TableColumnAdder.addColumn(project, editor, file, true); } }; } @Override - @NotNull - protected final CodeInsightActionHandler getHandler() { + protected final @NotNull CodeInsightActionHandler getHandler() { return myHandler; } @Override - protected boolean isValidForFile(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) { + protected boolean isValidForFile(final @NotNull Project project, final @NotNull Editor editor, final @NotNull PsiFile file) { return TableColumnAdder.isActionAvailable(editor, file); } } diff --git a/plugins/htmltools/src/com/intellij/htmltools/xml/actions/navigation/HtmlTableCellNavigateDownAction.java b/plugins/htmltools/src/com/intellij/htmltools/xml/actions/navigation/HtmlTableCellNavigateDownAction.java index 20ed2b2940c3..888574ef8e59 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/xml/actions/navigation/HtmlTableCellNavigateDownAction.java +++ b/plugins/htmltools/src/com/intellij/htmltools/xml/actions/navigation/HtmlTableCellNavigateDownAction.java @@ -8,13 +8,13 @@ import com.intellij.openapi.project.Project; import com.intellij.psi.PsiFile; import org.jetbrains.annotations.NotNull; -public class HtmlTableCellNavigateDownAction extends CodeInsightAction { +public final class HtmlTableCellNavigateDownAction extends CodeInsightAction { private final CodeInsightActionHandler myHandler; public HtmlTableCellNavigateDownAction() { myHandler = new CodeInsightActionHandler() { @Override - public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) { + public void invoke(final @NotNull Project project, final @NotNull Editor editor, final @NotNull PsiFile file) { TableCellNavigator.moveCaret(project, editor, file, TableCellNavigator.Directions.DOWN); } @@ -25,13 +25,12 @@ public class HtmlTableCellNavigateDownAction extends CodeInsightAction { }; } @Override - @NotNull - protected final CodeInsightActionHandler getHandler() { + protected final @NotNull CodeInsightActionHandler getHandler() { return myHandler; } @Override - protected boolean isValidForFile(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) { + protected boolean isValidForFile(final @NotNull Project project, final @NotNull Editor editor, final @NotNull PsiFile file) { return TableCellNavigator.isActionAvailable(editor, file); } } diff --git a/plugins/htmltools/src/com/intellij/htmltools/xml/actions/navigation/HtmlTableCellNavigateLeftAction.java b/plugins/htmltools/src/com/intellij/htmltools/xml/actions/navigation/HtmlTableCellNavigateLeftAction.java index bc5dc57c684c..22beb4e8bfbe 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/xml/actions/navigation/HtmlTableCellNavigateLeftAction.java +++ b/plugins/htmltools/src/com/intellij/htmltools/xml/actions/navigation/HtmlTableCellNavigateLeftAction.java @@ -8,13 +8,13 @@ import com.intellij.openapi.project.Project; import com.intellij.psi.PsiFile; import org.jetbrains.annotations.NotNull; -public class HtmlTableCellNavigateLeftAction extends CodeInsightAction { +public final class HtmlTableCellNavigateLeftAction extends CodeInsightAction { private final CodeInsightActionHandler myHandler; public HtmlTableCellNavigateLeftAction() { myHandler = new CodeInsightActionHandler() { @Override - public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) { + public void invoke(final @NotNull Project project, final @NotNull Editor editor, final @NotNull PsiFile file) { TableCellNavigator.moveCaret(project, editor, file, TableCellNavigator.Directions.LEFT); } @@ -25,13 +25,12 @@ public class HtmlTableCellNavigateLeftAction extends CodeInsightAction { }; } @Override - @NotNull - protected final CodeInsightActionHandler getHandler() { + protected final @NotNull CodeInsightActionHandler getHandler() { return myHandler; } @Override - protected boolean isValidForFile(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) { + protected boolean isValidForFile(final @NotNull Project project, final @NotNull Editor editor, final @NotNull PsiFile file) { return TableCellNavigator.isActionAvailable(editor, file); } } diff --git a/plugins/htmltools/src/com/intellij/htmltools/xml/actions/navigation/HtmlTableCellNavigateRightAction.java b/plugins/htmltools/src/com/intellij/htmltools/xml/actions/navigation/HtmlTableCellNavigateRightAction.java index e1e571dbca40..5d49f9fa0b2c 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/xml/actions/navigation/HtmlTableCellNavigateRightAction.java +++ b/plugins/htmltools/src/com/intellij/htmltools/xml/actions/navigation/HtmlTableCellNavigateRightAction.java @@ -8,13 +8,13 @@ import com.intellij.openapi.project.Project; import com.intellij.psi.PsiFile; import org.jetbrains.annotations.NotNull; -public class HtmlTableCellNavigateRightAction extends CodeInsightAction { +public final class HtmlTableCellNavigateRightAction extends CodeInsightAction { private final CodeInsightActionHandler myHandler; public HtmlTableCellNavigateRightAction() { myHandler = new CodeInsightActionHandler() { @Override - public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) { + public void invoke(final @NotNull Project project, final @NotNull Editor editor, final @NotNull PsiFile file) { TableCellNavigator.moveCaret(project, editor, file, TableCellNavigator.Directions.RIGHT); } @@ -25,13 +25,12 @@ public class HtmlTableCellNavigateRightAction extends CodeInsightAction { }; } @Override - @NotNull - protected final CodeInsightActionHandler getHandler() { + protected final @NotNull CodeInsightActionHandler getHandler() { return myHandler; } @Override - protected boolean isValidForFile(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) { + protected boolean isValidForFile(final @NotNull Project project, final @NotNull Editor editor, final @NotNull PsiFile file) { return TableCellNavigator.isActionAvailable(editor, file); } } diff --git a/plugins/htmltools/src/com/intellij/htmltools/xml/actions/navigation/HtmlTableCellNavigateUpAction.java b/plugins/htmltools/src/com/intellij/htmltools/xml/actions/navigation/HtmlTableCellNavigateUpAction.java index 0c1bbe9af62b..a25641dec856 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/xml/actions/navigation/HtmlTableCellNavigateUpAction.java +++ b/plugins/htmltools/src/com/intellij/htmltools/xml/actions/navigation/HtmlTableCellNavigateUpAction.java @@ -8,13 +8,13 @@ import com.intellij.openapi.project.Project; import com.intellij.psi.PsiFile; import org.jetbrains.annotations.NotNull; -public class HtmlTableCellNavigateUpAction extends CodeInsightAction { +public final class HtmlTableCellNavigateUpAction extends CodeInsightAction { private final CodeInsightActionHandler myHandler; public HtmlTableCellNavigateUpAction() { myHandler = new CodeInsightActionHandler() { @Override - public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) { + public void invoke(final @NotNull Project project, final @NotNull Editor editor, final @NotNull PsiFile file) { TableCellNavigator.moveCaret(project, editor, file, TableCellNavigator.Directions.UP); } @@ -25,13 +25,12 @@ public class HtmlTableCellNavigateUpAction extends CodeInsightAction { }; } @Override - @NotNull - protected final CodeInsightActionHandler getHandler() { + protected final @NotNull CodeInsightActionHandler getHandler() { return myHandler; } @Override - public boolean isValidForFile(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) { + public boolean isValidForFile(final @NotNull Project project, final @NotNull Editor editor, final @NotNull PsiFile file) { return TableCellNavigator.isActionAvailable(editor, file); } } diff --git a/plugins/htmltools/src/com/intellij/htmltools/xml/util/CheckImageSizeInspection.java b/plugins/htmltools/src/com/intellij/htmltools/xml/util/CheckImageSizeInspection.java index 564a865324a8..1893dba8ce0b 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/xml/util/CheckImageSizeInspection.java +++ b/plugins/htmltools/src/com/intellij/htmltools/xml/util/CheckImageSizeInspection.java @@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull; /** * @author Maxim Mossienko */ -public class CheckImageSizeInspection extends XmlSuppressableInspectionTool { +public final class CheckImageSizeInspection extends XmlSuppressableInspectionTool { private static final Logger LOG = Logger.getInstance(CheckImageSizeInspection.class); @Override @@ -50,8 +50,7 @@ public class CheckImageSizeInspection extends XmlSuppressableInspectionTool { } @Override - @NotNull - public String getFamilyName() { + public @NotNull String getFamilyName() { return myFamilyName; } @@ -71,8 +70,7 @@ public class CheckImageSizeInspection extends XmlSuppressableInspectionTool { } @Override - @NotNull - public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) { + public @NotNull PsiElementVisitor buildVisitor(final @NotNull ProblemsHolder holder, boolean isOnTheFly) { return new XmlElementVisitor() { @Override public void visitXmlAttribute(@NotNull XmlAttribute attribute) { XmlTag parent = attribute.getParent(); @@ -121,9 +119,7 @@ public class CheckImageSizeInspection extends XmlSuppressableInspectionTool { } @Override - @NotNull - @NonNls - public String getShortName() { + public @NotNull @NonNls String getShortName() { return "CheckImageSize"; } } diff --git a/plugins/htmltools/src/com/intellij/htmltools/xml/util/ColorReference.java b/plugins/htmltools/src/com/intellij/htmltools/xml/util/ColorReference.java index 2531b3c0096e..23fd308a412f 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/xml/util/ColorReference.java +++ b/plugins/htmltools/src/com/intellij/htmltools/xml/util/ColorReference.java @@ -13,34 +13,26 @@ import org.jetbrains.annotations.Nullable; import java.util.Set; public final class ColorReference extends BasicAttributeValueReference { - @NonNls - static final Set ourBgColorTagNames = Set.of("body", "td", "tr", "table", "th"); + static final @NonNls Set ourBgColorTagNames = Set.of("body", "td", "tr", "table", "th"); - @NonNls - static final String BG_COLOR_ATTR_NAME = "bgcolor"; + static final @NonNls String BG_COLOR_ATTR_NAME = "bgcolor"; - @NonNls - static final String COLOR_ATTR_NAME = "color"; + static final @NonNls String COLOR_ATTR_NAME = "color"; - @NonNls - static final String ALINK_ATTR_NAME = "alink"; + static final @NonNls String ALINK_ATTR_NAME = "alink"; - @NonNls - static final String LINK_ATTR_NAME = "link"; + static final @NonNls String LINK_ATTR_NAME = "link"; - @NonNls - static final String VLINK_ATTR_NAME = "vlink"; + static final @NonNls String VLINK_ATTR_NAME = "vlink"; - @NonNls - static final String TEXT_ATTR_NAME = "text"; + static final @NonNls String TEXT_ATTR_NAME = "text"; public ColorReference(final PsiElement element,int offset) { super(element, offset); } @Override - @Nullable - public PsiElement resolve() { + public @Nullable PsiElement resolve() { return myElement; // important for color doc } diff --git a/plugins/htmltools/src/com/intellij/htmltools/xml/util/HtmlReferenceProvider.java b/plugins/htmltools/src/com/intellij/htmltools/xml/util/HtmlReferenceProvider.java index 1fcab9b179b3..535b388ebc8b 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/xml/util/HtmlReferenceProvider.java +++ b/plugins/htmltools/src/com/intellij/htmltools/xml/util/HtmlReferenceProvider.java @@ -48,13 +48,13 @@ import java.util.*; import static com.intellij.util.ObjectUtils.doIfNotNull; -public class HtmlReferenceProvider extends PsiReferenceProvider { - @NonNls private static final String NAME_ATTR_LOCAL_NAME = "name"; - @NonNls private static final String USEMAP_ATTR_NAME = "usemap"; - @NonNls private static final String FOR_ATTR_NAME = "for"; - @NonNls private static final String HREF_ATTRIBUTE_NAME = "href"; - @NonNls private static final String SRC_ATTR_NAME = "src"; - @NonNls private static final String JAVASCRIPT_PREFIX = "javascript:"; +public final class HtmlReferenceProvider extends PsiReferenceProvider { + private static final @NonNls String NAME_ATTR_LOCAL_NAME = "name"; + private static final @NonNls String USEMAP_ATTR_NAME = "usemap"; + private static final @NonNls String FOR_ATTR_NAME = "for"; + private static final @NonNls String HREF_ATTRIBUTE_NAME = "href"; + private static final @NonNls String SRC_ATTR_NAME = "src"; + private static final @NonNls String JAVASCRIPT_PREFIX = "javascript:"; public static final FileType[] IMAGE_FILE_TYPES = new FileType[]{ImageFileTypeManager.getInstance().getImageFileType()}; public static final String LABELLEDBY = "aria-labelledby"; @@ -77,15 +77,15 @@ public class HtmlReferenceProvider extends PsiReferenceProvider { }; } - protected static boolean isAcceptableAttributeValue(PsiElement element) { + private static boolean isAcceptableAttributeValue(PsiElement element) { final PsiElement parent = element.getParent(); if (parent instanceof XmlAttribute xmlAttribute) { - @NonNls final String attrName = xmlAttribute.getName(); + final @NonNls String attrName = xmlAttribute.getName(); XmlTag tag = xmlAttribute.getParent(); if (tag == null) return false; - @NonNls final String tagName = tag.getName(); + final @NonNls String tagName = tag.getName(); return ( attrName.equalsIgnoreCase(SRC_ATTR_NAME) && @@ -170,7 +170,7 @@ public class HtmlReferenceProvider extends PsiReferenceProvider { } @Override - public PsiReference @NotNull [] getReferencesByElement(@NotNull PsiElement element, @NotNull final ProcessingContext context) { + public PsiReference @NotNull [] getReferencesByElement(@NotNull PsiElement element, final @NotNull ProcessingContext context) { final PsiElement parent = element.getParent(); if (!(parent instanceof XmlAttribute attribute)) return PsiReference.EMPTY_ARRAY; final String localName = attribute.getLocalName(); @@ -295,18 +295,17 @@ public class HtmlReferenceProvider extends PsiReferenceProvider { }; } - static class ContentTypeReference extends BasicAttributeValueReference { - private static @NonNls final String ourStyleContentType = "text/css"; + static final class ContentTypeReference extends BasicAttributeValueReference { + private static final @NonNls String ourStyleContentType = "text/css"; - @NonNls static final String TYPE_ATTR_NAME = "type"; + static final @NonNls String TYPE_ATTR_NAME = "type"; ContentTypeReference(final PsiElement element) { super(element); } @Override - @Nullable - public PsiElement resolve() { + public @Nullable PsiElement resolve() { return null; } @@ -338,10 +337,10 @@ public class HtmlReferenceProvider extends PsiReferenceProvider { } } - public static class SizeReference extends BasicAttributeValueReference { - @NonNls static final String WIDTH_ATTR_NAME = "width"; - @NonNls static final String HEIGHT_ATTR_NAME = "height"; - @NonNls static final String IMAGE_TAG_NAME = "img"; + public static final class SizeReference extends BasicAttributeValueReference { + static final @NonNls String WIDTH_ATTR_NAME = "width"; + static final @NonNls String HEIGHT_ATTR_NAME = "height"; + static final @NonNls String IMAGE_TAG_NAME = "img"; private final boolean myIsWidth; @@ -354,8 +353,7 @@ public class HtmlReferenceProvider extends PsiReferenceProvider { } @Override - @Nullable - public PsiElement resolve() { + public @Nullable PsiElement resolve() { final ImageInfoReader.Info info = getImageInfo(); if (info != null && info.width != 0 && info.height != 0) { String text = getCanonicalText(); @@ -388,8 +386,7 @@ public class HtmlReferenceProvider extends PsiReferenceProvider { return tag != null ? getImageInfo(tag) : null; } - @Nullable - public static ImageInfoReader.Info getImageInfo(@NotNull final XmlTag tag) { + public static @Nullable ImageInfoReader.Info getImageInfo(final @NotNull XmlTag tag) { return CachedValuesManager.getCachedValue(tag, () -> { PsiElement srcValue = JBIterable.from(HtmlAttributeValueProvider.EP_NAME.getExtensionList()) .filterMap(it -> it.getCustomAttributeValue(tag, SRC_ATTR_NAME)) @@ -453,7 +450,7 @@ public class HtmlReferenceProvider extends PsiReferenceProvider { } } - private static class HtmlIdSelfReference extends AttributeValueSelfReference { + private static final class HtmlIdSelfReference extends AttributeValueSelfReference { HtmlIdSelfReference(final PsiElement element, int offset) { super(element, offset); } @@ -464,7 +461,7 @@ public class HtmlReferenceProvider extends PsiReferenceProvider { IdRefReference.process(new PsiElementProcessor<>() { @Override - public boolean execute(@NotNull final PsiElement element) { + public boolean execute(final @NotNull PsiElement element) { if (element instanceof XmlTag) { String forValue = ((XmlTag)element).getAttributeValue(IdReferenceProvider.FOR_ATTR_NAME); if (forValue != null) { @@ -479,7 +476,7 @@ public class HtmlReferenceProvider extends PsiReferenceProvider { } } - public static class HtmlIdRefReference extends IdRefReference { + public static final class HtmlIdRefReference extends IdRefReference { public HtmlIdRefReference(PsiElement element, int offset) { super(element, offset, true); } diff --git a/plugins/htmltools/src/com/intellij/htmltools/xml/util/HtmlUpdateImageSizeIntention.java b/plugins/htmltools/src/com/intellij/htmltools/xml/util/HtmlUpdateImageSizeIntention.java index 5b52200c5f6b..f4e5be945f20 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/xml/util/HtmlUpdateImageSizeIntention.java +++ b/plugins/htmltools/src/com/intellij/htmltools/xml/util/HtmlUpdateImageSizeIntention.java @@ -16,13 +16,11 @@ import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class HtmlUpdateImageSizeIntention extends BaseIntentionAction { +public final class HtmlUpdateImageSizeIntention extends BaseIntentionAction { private boolean myUseElementToTheLeft = false; - @Nls - @NotNull @Override - public String getFamilyName() { + public @Nls @NotNull String getFamilyName() { return HtmlToolsBundle.message("html.intention.update.image.size"); } @@ -74,8 +72,7 @@ public class HtmlUpdateImageSizeIntention extends BaseIntentionAction { } } - @Nullable - private static ImageInfo getImageInfo(@NotNull XmlTag xmlTag) { + private static @Nullable ImageInfo getImageInfo(@NotNull XmlTag xmlTag) { if (HtmlReferenceProvider.SizeReference.IMAGE_TAG_NAME.equalsIgnoreCase(xmlTag.getName())) { return HtmlReferenceProvider.SizeReference.getImageInfo(xmlTag); } @@ -83,8 +80,7 @@ public class HtmlUpdateImageSizeIntention extends BaseIntentionAction { } - @Nullable - private static XmlTag getTag(@NotNull PsiFile file, int offset) { + private static @Nullable XmlTag getTag(@NotNull PsiFile file, int offset) { if (!HtmlUtil.hasHtml(file)) { return null; } diff --git a/plugins/htmltools/src/com/intellij/htmltools/xml/util/XHtmlErrorFilter.java b/plugins/htmltools/src/com/intellij/htmltools/xml/util/XHtmlErrorFilter.java index af9250ace1ee..0eced6b616a2 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/xml/util/XHtmlErrorFilter.java +++ b/plugins/htmltools/src/com/intellij/htmltools/xml/util/XHtmlErrorFilter.java @@ -8,7 +8,7 @@ import com.intellij.psi.PsiErrorElement; import com.intellij.psi.PsiFile; import org.jetbrains.annotations.NotNull; -public class XHtmlErrorFilter extends HighlightErrorFilter { +public final class XHtmlErrorFilter extends HighlightErrorFilter { @Override public boolean shouldHighlightErrorElement(@NotNull PsiErrorElement element) { PsiFile containingFile = element.getContainingFile();