void (PsiAssignmentExpression assignmentExpression) { final PsiJavaToken sign = assignmentExpression.getOperationSign(); if (JavaTokenType.EQ.equals(sign.getTokenType())) throw new IllegalArgumentException(); final CommentTracker commentTracker = new CommentTracker(); final PsiExpression lhs = assignmentExpression.getLExpression(); final String lhsText = commentTracker.text(lhs); StringBuilder builder = new StringBuilder(); builder.append(lhsText).append('='); final PsiExpression rhs = assignmentExpression.getRExpression(); if (rhs == null) return; final PsiType rhsType = rhs.getType(); if (rhsType == null) return; final PsiType promotedType = TypeConversionUtil.binaryNumericPromotion(assignmentExpression.getType(), rhsType); final PsiType lhsType = lhs.getType(); if (lhsType == null) return; final boolean cast = !promotedType.equals(lhsType); if (cast) { builder.append('(').append(lhsType.getCanonicalText()).append(")("); if (!ignoreWideningConversions && (!ignoreCharConversions || !isCharConversion(lhsType, promotedType))) { builder.append("(").append(promotedType.getCanonicalText()).append(')'); } } builder.append(lhsText).append(StringUtil.substringBefore(sign.getText(), "=")); if (!ignoreWideningConversions && !promotedType.equals(rhsType) && !(ignoreCharConversions && isCharConversion(rhsType, promotedType))) { builder.append('(').append(promotedType.getCanonicalText()).append(')'); } builder.append(commentTracker.text(rhs)); if (cast) { builder.append(')'); } final String newExpressionText = builder.toString(); PsiReplacementUtil.replaceExpression(assignmentExpression, newExpressionText, commentTracker); }