mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
RedundantCastInspection: IGNORE_ANNOTATED_METHODS option removed
After change 3c9c050b4 it's always on anyways
This commit is contained in:
+2
-23
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.intellij.codeInspection.redundantCast;
|
||||
|
||||
import com.intellij.codeInsight.NullableNotNullManager;
|
||||
import com.intellij.codeInsight.daemon.GroupNames;
|
||||
import com.intellij.codeInspection.*;
|
||||
import com.intellij.codeInspection.miscGenerics.GenericsInspectionToolBase;
|
||||
@@ -45,7 +44,6 @@ public class RedundantCastInspection extends GenericsInspectionToolBase {
|
||||
private static final String DISPLAY_NAME = InspectionsBundle.message("inspection.redundant.cast.display.name");
|
||||
@NonNls private static final String SHORT_NAME = "RedundantCast";
|
||||
|
||||
public boolean IGNORE_ANNOTATED_METHODS;
|
||||
public boolean IGNORE_SUSPICIOUS_METHOD_CALLS;
|
||||
|
||||
|
||||
@@ -71,7 +69,7 @@ public class RedundantCastInspection extends GenericsInspectionToolBase {
|
||||
|
||||
@Override
|
||||
public void writeSettings(@NotNull Element node) throws WriteExternalException {
|
||||
if (IGNORE_ANNOTATED_METHODS || IGNORE_SUSPICIOUS_METHOD_CALLS) {
|
||||
if (IGNORE_SUSPICIOUS_METHOD_CALLS) {
|
||||
super.writeSettings(node);
|
||||
}
|
||||
}
|
||||
@@ -80,7 +78,6 @@ public class RedundantCastInspection extends GenericsInspectionToolBase {
|
||||
public JComponent createOptionsPanel() {
|
||||
final MultipleCheckboxOptionsPanel optionsPanel = new MultipleCheckboxOptionsPanel(this);
|
||||
optionsPanel.addCheckbox("Ignore casts in suspicious collections method calls", "IGNORE_SUSPICIOUS_METHOD_CALLS");
|
||||
optionsPanel.addCheckbox("Ignore casts to invoke @NotNull method which overrides @Nullable", "IGNORE_ANNOTATED_METHODS");
|
||||
return optionsPanel;
|
||||
}
|
||||
|
||||
@@ -90,25 +87,7 @@ public class RedundantCastInspection extends GenericsInspectionToolBase {
|
||||
PsiTypeElement castType = cast.getCastType();
|
||||
if (operand == null || castType == null) return null;
|
||||
PsiElement parent = PsiUtil.skipParenthesizedExprUp(cast.getParent());
|
||||
if (parent instanceof PsiReferenceExpression) {
|
||||
if (IGNORE_ANNOTATED_METHODS) {
|
||||
final PsiElement gParent = parent.getParent();
|
||||
if (gParent instanceof PsiMethodCallExpression) {
|
||||
final PsiMethod psiMethod = ((PsiMethodCallExpression)gParent).resolveMethod();
|
||||
if (psiMethod != null && NullableNotNullManager.isNotNull(psiMethod)) {
|
||||
final PsiClass superClass = PsiUtil.resolveClassInType(operand.getType());
|
||||
final PsiClass containingClass = psiMethod.getContainingClass();
|
||||
if (containingClass != null && superClass != null && containingClass.isInheritor(superClass, true)) {
|
||||
for (PsiMethod method : psiMethod.findSuperMethods(superClass)) {
|
||||
if (NullableNotNullManager.isNullable(method)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (parent instanceof PsiExpressionList) {
|
||||
if (parent instanceof PsiExpressionList) {
|
||||
final PsiElement gParent = parent.getParent();
|
||||
if (gParent instanceof PsiMethodCallExpression && IGNORE_SUSPICIOUS_METHOD_CALLS) {
|
||||
final String message = SuspiciousMethodCallUtil
|
||||
|
||||
@@ -87,7 +87,6 @@ public class RedundantCast15Test extends InspectionTestCase {
|
||||
|
||||
public void testIgnore() {
|
||||
final RedundantCastInspection castInspection = new RedundantCastInspection();
|
||||
castInspection.IGNORE_ANNOTATED_METHODS = true;
|
||||
castInspection.IGNORE_SUSPICIOUS_METHOD_CALLS = true;
|
||||
final LocalInspectionToolWrapper tool = new LocalInspectionToolWrapper(castInspection);
|
||||
doTest("redundantCast/generics/" + getTestName(false), tool, "java 1.5");
|
||||
|
||||
Reference in New Issue
Block a user