mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
InstanceofCatchParameter inspection should not report instanceof check on marker interfaces (ex: ControlFlowException)
This commit is contained in:
+6
-2
@@ -16,6 +16,7 @@
|
||||
package com.siyeh.ig.errorhandling;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.InheritanceUtil;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
import com.siyeh.ig.BaseInspectionVisitor;
|
||||
@@ -47,12 +48,15 @@ public class InstanceofCatchParameterInspection extends BaseInspection {
|
||||
extends BaseInspectionVisitor {
|
||||
|
||||
@Override
|
||||
public void visitInstanceOfExpression(
|
||||
@NotNull PsiInstanceOfExpression exp) {
|
||||
public void visitInstanceOfExpression(@NotNull PsiInstanceOfExpression exp) {
|
||||
super.visitInstanceOfExpression(exp);
|
||||
if (!ControlFlowUtils.isInCatchBlock(exp)) {
|
||||
return;
|
||||
}
|
||||
PsiTypeElement typeElement = exp.getCheckType();
|
||||
if (typeElement == null || !InheritanceUtil.isInheritor(typeElement.getType(), CommonClassNames.JAVA_LANG_THROWABLE)) {
|
||||
return;
|
||||
}
|
||||
final PsiExpression operand = exp.getOperand();
|
||||
if (!(operand instanceof PsiReferenceExpression)) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user