void (@NotNull PsiTypeCastExpression expression) { super.visitTypeCastExpression(expression); final PsiExpression operand = expression.getOperand(); if (!isParameterReference(operand)) return; final PsiTryStatement statement = PsiTreeUtil.getParentOfType(expression, PsiTryStatement.class); if (statement == null) return; final PsiParameter[] parameters = statement.getCatchBlockParameters(); if (parameters.length < 2) return; boolean nullPointerExceptionFound = false; boolean classCastExceptionFound = false; for (PsiParameter parameter : parameters) { final PsiType type = parameter.getType(); if (type.equalsToText("java.lang.NullPointerException")) { nullPointerExceptionFound = true; if (classCastExceptionFound) break; } else if (type.equalsToText("java.lang.ClassCastException")) { classCastExceptionFound = true; if (nullPointerExceptionFound) break; } } if (classCastExceptionFound && nullPointerExceptionFound) { makeChecked(); } }