private static void addTypeToCatch(@NotNull List<? extends PsiClassType> exceptionsToAdd, 
                                     @NotNull PsiCatchSection catchSection, 
                                     Project project) {
    if (!catchSection.isValid() || !ContainerUtil.and(exceptionsToAdd, type -> type.isValid())) return;
    PsiParameter parameter = catchSection.getParameter();
    if (parameter == null) return;
    PsiTypeElement typeElement = parameter.getTypeElement();
    if (typeElement == null) return;
    PsiType parameterType = parameter.getType();
    PsiElementFactory factory = JavaPsiFacade.getElementFactory(project);
    String flattenText = getTypeText(exceptionsToAdd, parameterType);
    PsiElement newTypeElement = typeElement.replace(factory.createTypeElementFromText(flattenText, parameter));
    CodeStyleManager.getInstance(project).reformat(JavaCodeStyleManager.getInstance(project).shortenClassReferences(newTypeElement));
  }
private static void addTypeToCatch(@NotNull List<? extends PsiClassType> exceptionsToAdd, 
                                     @NotNull PsiCatchSection catchSection, 
                                     Project project)