String (@NotNull List<? extends PsiClassType> exceptionsToAdd, PsiType parameterType) { ArrayList<PsiType> types = new ArrayList<>(); types.add(parameterType); types.addAll(exceptionsToAdd); return PsiDisjunctionType.flattenAndRemoveDuplicates(types) .stream() .map(type -> type.getCanonicalText()) .collect(Collectors.joining(" | ")); }