void (@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 = PsiUtil.skipParenthesizedExprDown(exp.getOperand()); if (!(operand instanceof PsiReferenceExpression ref)) { return; } final PsiElement referent = ref.resolve(); if (!(referent instanceof PsiParameter parameter)) { return; } if (!(parameter.getDeclarationScope() instanceof PsiCatchSection)) { return; } registerError(operand); }