PsiType (PsiType @NotNull [] types) { final Set<PsiType> flattened = PsiIntersectionType.flatten(types, new LinkedHashSet<>() { @Override public boolean add(PsiType type) { remove(type); return super.add(type); } }); final PsiType[] conjuncts = flattened.toArray(PsiType.createArray(flattened.size())); if (conjuncts.length == 1) { return conjuncts[0]; } else { return new GrTraitType((PsiIntersectionType)PsiIntersectionType.createIntersection(false, conjuncts)); } }