mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
report redundant suppressions on line with suppression or on corresponding member if member annotated (IDEA-145472)
This commit is contained in:
+2
-3
@@ -72,10 +72,9 @@ public class RemoveSuppressWarningAction implements LocalQuickFix {
|
||||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
|
||||
PsiElement element = descriptor.getPsiElement();
|
||||
try {
|
||||
if (element instanceof PsiIdentifier) {
|
||||
if (element != null) {
|
||||
if (!FileModificationService.getInstance().prepareFileForWrite(element.getContainingFile())) return;
|
||||
final PsiIdentifier identifier = (PsiIdentifier)element;
|
||||
final PsiDocCommentOwner commentOwner = PsiTreeUtil.getParentOfType(identifier, PsiDocCommentOwner.class);
|
||||
final PsiDocCommentOwner commentOwner = PsiTreeUtil.getParentOfType(element, PsiDocCommentOwner.class);
|
||||
if (commentOwner != null) {
|
||||
final PsiElement psiElement = JavaSuppressionUtil.getElementMemberSuppressedIn(commentOwner, myID);
|
||||
if (psiElement instanceof PsiAnnotation) {
|
||||
|
||||
+4
-1
@@ -292,7 +292,10 @@ public class RedundantSuppressInspectionBase extends GlobalInspectionTool {
|
||||
myQuickFixes.put(key, fix);
|
||||
}
|
||||
PsiElement identifier = null;
|
||||
if (psiMember instanceof PsiMethod) {
|
||||
if (!(suppressedScope instanceof PsiMember)) {
|
||||
identifier = suppressedScope;
|
||||
}
|
||||
else if (psiMember instanceof PsiMethod) {
|
||||
identifier = ((PsiMethod)psiMember).getNameIdentifier();
|
||||
}
|
||||
else if (psiMember instanceof PsiField) {
|
||||
|
||||
+2
-2
@@ -6,8 +6,8 @@ public class Test {
|
||||
static <T> void foo(T... t){
|
||||
}
|
||||
|
||||
void fo<caret>o() {
|
||||
//noinspection unchecked
|
||||
void foo() {
|
||||
//noinspec<caret>tion unchecked
|
||||
foo(new ArrayList<String>());
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ public class SampleSafeVarargs {
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
void foo() {
|
||||
void fo<caret>o() {
|
||||
asList(new ArrayList<String>());
|
||||
List<Object> l ;
|
||||
ArrayList strings = new ArrayList<String>();
|
||||
|
||||
+2
-2
@@ -6,8 +6,8 @@ public class Test {
|
||||
static <T> void foo(T... t){
|
||||
}
|
||||
|
||||
void f<caret>oo() {
|
||||
//noinspection unchecked,blah-blah-toolid
|
||||
void foo() {
|
||||
//noinsp<caret>ection unchecked,blah-blah-toolid
|
||||
foo(new ArrayList<String>());
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -11,8 +11,8 @@ public class Test {
|
||||
return null;
|
||||
}
|
||||
|
||||
void fo<caret>o() {
|
||||
//noinspection unchecked
|
||||
void foo() {
|
||||
//noinspe<caret>ction unchecked
|
||||
foo(new ArrayList<String>()).addAll(foo1(new ArrayList<String>()));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -7,8 +7,8 @@ public class Test {
|
||||
return null;
|
||||
}
|
||||
|
||||
void fo<caret>o() {
|
||||
//noinspection unchecked
|
||||
void foo() {
|
||||
//noinspe<caret>ction unchecked
|
||||
List<ArrayList<String>> list = foo(new ArrayList<String>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<problem>
|
||||
<file>X.java</file>
|
||||
<line>4</line>
|
||||
<line>5</line>
|
||||
<problem_class>Redundant suppression</problem_class>
|
||||
<description>Redundant suppression</description>
|
||||
<entry_point TYPE="method" FQNAME="x.S void f()" />
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
<problem>
|
||||
<file>X.java</file>
|
||||
<line>19</line>
|
||||
<line>20</line>
|
||||
<problem_class>Redundant suppression</problem_class>
|
||||
<description>Redundant suppression</description>
|
||||
<entry_point TYPE="method" FQNAME="x.S void h()" />
|
||||
|
||||
Reference in New Issue
Block a user