PsiClassType (@NotNull PsiClass psiClass) { final PsiElementFactory factory = JavaPsiFacade.getElementFactory(psiClass.getProject()); if (psiClass.hasTypeParameters()) { final PsiType[] psiTypes = Stream.of(psiClass.getTypeParameters()).map(factory::createType).toArray(PsiType[]::new); return factory.createType(psiClass, psiTypes); } else { return factory.createType(psiClass); } }