String (@NotNull PsiExpression unboxedExpression, @NotNull PsiExpression boxedExpression, CommentTracker commentTracker) { final PsiType boxedType = boxedExpression.getType(); if (boxedType == null) { return null; } final PsiType expressionType = unboxedExpression.getType(); if (expressionType == null) { return null; } final PsiType unboxedType = PsiPrimitiveType.getUnboxedType(boxedType); if (unboxedType == null) { return null; } final String text = commentTracker.text(unboxedExpression); if (expressionType.equals(unboxedType)) { final PsiElement parent = boxedExpression.getParent(); if (parent instanceof PsiExpression && ParenthesesUtils.areParenthesesNeeded(unboxedExpression, (PsiExpression)parent, false)) { return '(' + text + ')'; } else { return text; } } if (unboxedExpression instanceof PsiLiteralExpression) { String newLiteral = PsiLiteralUtil.tryConvertNumericLiteral((PsiLiteralExpression)unboxedExpression, unboxedType); if (newLiteral != null) { return newLiteral; } } if (ParenthesesUtils.getPrecedence(unboxedExpression) > ParenthesesUtils.TYPE_CAST_PRECEDENCE) { return '(' + unboxedType.getCanonicalText() + ")(" + text + ')'; } else { return '(' + unboxedType.getCanonicalText() + ')' + text; } }