void (PsiExpression rExpr, @Nullable PsiType lType) { rExpr = deparenthesizeExpression(rExpr); if (rExpr instanceof PsiTypeCastExpression) { PsiExpression castOperand = getInnerMostOperand(rExpr); if (castOperand != null && lType != null) { PsiExpression expected = getOpWithExpectedType(castOperand, lType); PsiType opType = expected != null ? expected.getType() : null; if (opType != null) { if (expected instanceof PsiConditionalExpression) { if (!isApplicableForConditionalBranch(opType, ((PsiConditionalExpression)expected).getThenExpression())) return; if (!isApplicableForConditionalBranch(opType, ((PsiConditionalExpression)expected).getElseExpression())) return; } if (expected instanceof PsiSwitchExpression) { for (PsiExpression resultExpression : PsiUtil.getSwitchResultExpressions((PsiSwitchExpression)expected)) { if (!isApplicableForConditionalBranch(opType, resultExpression)) return; } } if (TypeConversionUtil.isAssignable(lType, opType, false)) { if (!isFunctionalExpressionTypePreserved((PsiTypeCastExpression)rExpr, expected, lType)) return; addToResults((PsiTypeCastExpression)rExpr); } } } } }