void (@NotNull PsiExpression expression) { final PsiType type = expression.getType(); if (!(type instanceof PsiPrimitiveType)) return; final PsiType expectedType = ((PsiPrimitiveType)type).getBoxedType(expression); if (expectedType == null) { return; } final String expectedTypeText = expectedType.getCanonicalText(); final String classToConstruct; if (s_boxingClasses.containsValue(expectedTypeText)) { classToConstruct = expectedTypeText; } else { final String expressionTypeText = type.getCanonicalText(); classToConstruct = s_boxingClasses.get(expressionTypeText); } if (shortcutReplace(expression, classToConstruct)) { return; } final PsiExpression strippedExpression = PsiUtil.skipParenthesizedExprDown(expression); if (strippedExpression == null) { return; } CommentTracker commentTracker = new CommentTracker(); @NonNls final String expressionText = strippedExpression.getText(); @NonNls final String newExpression; if ("true".equals(expressionText)) { newExpression = "java.lang.Boolean.TRUE"; } else if ("false".equals(expressionText)) { newExpression = "java.lang.Boolean.FALSE"; } else { commentTracker.markUnchanged(strippedExpression); newExpression = classToConstruct + ".valueOf(" + expressionText + ')'; } final PsiElement parent = expression.getParent(); if (parent instanceof PsiTypeCastExpression typeCastExpression) { PsiReplacementUtil.replaceExpression(typeCastExpression, newExpression, commentTracker); } else { PsiReplacementUtil.replaceExpression(expression, newExpression, commentTracker); } }