PsiClass (PsiClass psiClass, CreateClassKind classKind, String name, PsiJavaCodeReferenceElement referenceElement, @Nullable String superClassName) { PsiManager manager = psiClass.getManager(); PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(manager.getProject()); PsiClass result = classKind == CreateClassKind.INTERFACE ? elementFactory.createInterface(name) : classKind == CreateClassKind.CLASS ? elementFactory.createClass(name) : classKind == CreateClassKind.ANNOTATION ? elementFactory.createAnnotationType(name) : classKind == CreateClassKind.RECORD ? elementFactory.createRecord(name) : elementFactory.createEnum(name); CreateFromUsageBaseFix.setupGenericParameters(result, referenceElement); result = (PsiClass)CodeStyleManager.getInstance(manager.getProject()).reformat(result); if (!StringUtil.isEmpty(superClassName)) { setupSuperClassReference(result, superClassName); } return (PsiClass) psiClass.add(result); }