boolean (PsiParameter throwable, PsiCodeBlock catchBlock) { final PsiStatement lastStatement = ControlFlowUtils.getLastStatementInBlock(catchBlock); if (!(lastStatement instanceof PsiThrowStatement throwStatement)) { return false; } final PsiExpression expression = throwStatement.getException(); if (!(expression instanceof PsiReferenceExpression referenceExpression)) { return false; } final PsiElement element = referenceExpression.resolve(); return throwable.equals(element); }