String (PsiExpression expression, PsiLocalVariable variable, PsiExpression limitExpression, boolean plusOne, CommentTracker commentTracker) { if (expression == null) { return null; } final String expressionText = commentTracker.text(expression); final String variableName = variable.getName(); if (expressionText.equals(variableName)) { final PsiExpression initialValue = PsiUtil.skipParenthesizedExprDown(limitExpression); if (initialValue == null) { return null; } return buildExpressionText(initialValue, plusOne, commentTracker); } else if (expression instanceof PsiBinaryExpression binaryExpression) { final PsiExpression lhs = binaryExpression.getLOperand(); final PsiExpression rhs = binaryExpression.getROperand(); final String rhsText = buildOffsetText(rhs, variable, limitExpression, plusOne, commentTracker); final PsiJavaToken sign = binaryExpression.getOperationSign(); final IElementType tokenType = sign.getTokenType(); if (ExpressionUtils.isZero(lhs)) { return tokenType.equals(JavaTokenType.MINUS) ? '-' + rhsText : rhsText; } if (plusOne && tokenType.equals(JavaTokenType.MINUS) && ExpressionUtils.isOne(rhs)) { return buildOffsetText(lhs, variable, limitExpression, false, commentTracker); } final String lhsText = buildOffsetText(lhs, variable, limitExpression, plusOne, commentTracker); if (ExpressionUtils.isZero(rhs)) { return lhsText; } return collapseConstant(lhsText + sign.getText() + rhsText, variable); } return collapseConstant(commentTracker.text(expression), variable); }