boolean (@NotNull PsiType whoType, @NotNull PsiType overWhom) { List<PsiType> whoTypes = getAllTypes(whoType); List<PsiType> overWhomTypes = getAllTypes(overWhom); for (PsiType currentWhoType : whoTypes) { if (!ContainerUtil.exists(overWhomTypes, currentOverWhomType -> JavaPsiPatternUtil.dominates(currentWhoType, currentOverWhomType))) { return false; } } return true; }