void (@NotNull PsiThrowStatement statement) { super.visitThrowStatement(statement); final PsiExpression exception = PsiUtil.skipParenthesizedExprDown(statement.getException()); if (exception == null) { return; } final PsiType type = exception.getType(); if (type == null) { return; } final PsiCodeBlock finallyBlock = getContainingFinallyBlock(statement, type); if (finallyBlock == null) { return; } if (exception instanceof PsiReferenceExpression referenceExpression) { final PsiElement target = referenceExpression.resolve(); if (target == null || !PsiTreeUtil.isAncestor(finallyBlock, target, true)) { // variable from outside finally block is thrown return; } } if (isHidingOfPreviousException(finallyBlock, statement)) { registerStatementError(statement); } }