boolean (@NotNull PsiExpression expression) { final PsiNewExpression newExpression = PsiTreeUtil.getParentOfType(expression, PsiNewExpression.class, true, PsiCodeBlock.class, PsiClass.class); if (newExpression != null) { final PsiType newExpressionType = newExpression.getType(); if (InheritanceUtil.isInheritor(newExpressionType, CommonClassNames.JAVA_LANG_THROWABLE)) { return true; } } else { final PsiMethodCallExpression methodCallExpression = PsiTreeUtil.getParentOfType(expression, PsiMethodCallExpression.class, true, PsiCodeBlock.class, PsiClass.class); if (JavaPsiConstructorUtil.isConstructorCall(methodCallExpression)) { final PsiMethod constructor = methodCallExpression.resolveMethod(); return constructor != null && InheritanceUtil.isInheritor(constructor.getContainingClass(), CommonClassNames.JAVA_LANG_THROWABLE); } } return false; }