void (@NotNull Project project, @NotNull PsiElement castTypeElement, @NotNull ModPsiUpdater updater) { final PsiTypeCastExpression expression = (PsiTypeCastExpression)castTypeElement.getParent(); if (expression == null) { return; } final PsiType expectedType = ExpectedTypeUtils.findExpectedType(expression, true); if (expectedType == null) { return; } final PsiExpression operand = expression.getOperand(); if (operand == null) { return; } CommentTracker commentTracker = new CommentTracker(); @NonNls final String newExpression = '(' + expectedType.getCanonicalText() + ')' + commentTracker.text(operand); PsiReplacementUtil.replaceExpressionAndShorten(expression, newExpression, commentTracker); }