IntentionPreviewInfo (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { PsiVariable variable = getVariable(getElement(editor, file)); if (variable == null) return IntentionPreviewInfo.EMPTY; PsiType type = variable.getType(); String toType = myFromToMap.get(type); String variableName = variable.getName(); String modifiedText; if (toType == null) { Class<?> atomicClass; if (type instanceof PsiArrayType arrayType) { type = arrayType.getComponentType(); atomicClass = AtomicReferenceArray.class; } else { atomicClass = AtomicReference.class; } String presentableText = StringUtil.getShortName(atomicClass.getName()); modifiedText = presentableText + '<' + type.getPresentableText() + "> " + variableName + " = new " + presentableText + "<>(...)"; } else { String presentableText = StringUtil.getShortName(toType); modifiedText = presentableText + " " + variableName + " = new " + presentableText + "(...)"; } return new IntentionPreviewInfo.CustomDiff(JavaFileType.INSTANCE, type.getPresentableText() + " " + variableName, modifiedText); }