PsiExpression (@NotNull PsiExpression expression) { while (true) { if (expression instanceof PsiParenthesizedExpression) { expression = ((PsiParenthesizedExpression)expression).getExpression(); continue; } if (expression instanceof PsiTypeCastExpression) { final PsiTypeCastExpression typeCastExpression = (PsiTypeCastExpression)expression; final PsiType castType = typeCastExpression.getType(); final PsiExpression operand = typeCastExpression.getOperand(); if (operand == null) { return expression; } if (TypeConversionUtil.isNumericType(castType)) { final PsiType operandType = operand.getType(); if (operandType == null) { return expression; } final int castRank = TypeConversionUtil.getTypeRank(castType); final int operandRank = TypeConversionUtil.getTypeRank(operandType); if (castRank < operandRank || castRank == TypeConversionUtil.CHAR_RANK && operandRank != castRank) { return expression; } } expression = operand; continue; } return expression; } }