void (@NotNull PsiParenthesizedExpression parenthesized) { EliminableExpression expression = createEliminableExpression(parenthesized); if (expression == null) return; StringBuilder sb = new StringBuilder(); CommentTracker commentTracker = new CommentTracker(); PsiExpression toReplace = expression.getExpressionToReplace(); PsiPolyadicExpression outerExpression = ObjectUtils.tryCast(toReplace.getParent(), PsiPolyadicExpression.class); if (outerExpression == null || EliminateUtils.getOperator(outerExpression.getOperationTokenType()) == null) { if (!expression.eliminate(null, sb)) return; PsiReplacementUtil.replaceExpression(toReplace, sb.toString(), commentTracker); return; } for (PsiExpression operand : outerExpression.getOperands()) { PsiJavaToken tokenBefore = outerExpression.getTokenBeforeOperand(operand); if (operand == toReplace) { if (!expression.eliminate(tokenBefore, sb)) return; continue; } if (tokenBefore != null) sb.append(tokenBefore.getText()); sb.append(operand.getText()); } PsiReplacementUtil.replaceExpression(outerExpression, sb.toString(), commentTracker); }