mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
redundant suppression: search for text with suppressId in narrow element if applicable (IDEA-221643)
GitOrigin-RevId: 1b13bcda0f78e882ddd51a0d6eccb4a662a441c4
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ebab15db82
commit
c9c3a31e74
@@ -5,6 +5,8 @@ package com.intellij.codeInspection;
|
||||
import com.intellij.codeInsight.daemon.HighlightDisplayKey;
|
||||
import com.intellij.codeInsight.daemon.impl.RemoveSuppressWarningAction;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiComment;
|
||||
import com.intellij.psi.PsiDocCommentOwner;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
@@ -65,6 +67,16 @@ public class SuppressManagerImpl extends SuppressManager implements RedundantSup
|
||||
return suppressionScope != null && PsiTreeUtil.isAncestor(elementWithSuppression, suppressionScope, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextRange getHighlightingRange(PsiElement elementWithSuppression, String toolId) {
|
||||
PsiElement annotationOrTagElement = elementWithSuppression instanceof PsiComment ? null : getElementToolSuppressedIn(elementWithSuppression, toolId);
|
||||
if (annotationOrTagElement != null) {
|
||||
int shiftInParent = annotationOrTagElement.getTextRange().getStartOffset() - elementWithSuppression.getTextRange().getStartOffset();
|
||||
return RedundantSuppressionDetector.super.getHighlightingRange(annotationOrTagElement, toolId).shiftRight(shiftInParent);
|
||||
}
|
||||
return RedundantSuppressionDetector.super.getHighlightingRange(elementWithSuppression, toolId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocalQuickFix createRemoveRedundantSuppressionFix(@NotNull String toolId) {
|
||||
return new RemoveSuppressWarningAction(toolId);
|
||||
|
||||
+3
@@ -7,6 +7,9 @@ public class Test {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Some javadoc with unchecked word inside
|
||||
*/
|
||||
void foo() {
|
||||
List<ArrayList<String>> list = foo(new ArrayList<String>());
|
||||
}
|
||||
|
||||
+3
@@ -7,6 +7,9 @@ public class Test {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Some javadoc with unchecked word inside
|
||||
*/
|
||||
@SuppressWarnings("unch<caret>ecked")
|
||||
void foo() {
|
||||
List<ArrayList<String>> list = foo(new ArrayList<String>());
|
||||
|
||||
Reference in New Issue
Block a user