IntentionPreviewInfo (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { PsiReferenceParameterList parameterList = PsiTreeUtil.findSameElementInCopy(myParameterList, file); PsiTypeParameter[] classTypeParameters = myClass.getTypeParameters(); List<TypeParameterInfoView> parameters = createTypeParameters(JavaCodeFragmentFactory.getInstance(project), Arrays.asList(classTypeParameters), Arrays.asList(parameterList.getTypeParameterElements())); String className = "class " + myClass.getName(); String originClassDeclaration = className + (classTypeParameters.length == 0 ? "" : "<" + StringUtil.join(classTypeParameters, p -> p.getName(), ",") + ">"); String modifiedClassDeclaration = className + "<" + StringUtil.join(parameters, p -> p.getInfo().getName(classTypeParameters), ", ") + ">"; return new IntentionPreviewInfo.CustomDiff(JavaFileType.INSTANCE, originClassDeclaration, modifiedClassDeclaration); }