void (@NotNull Project project, @NotNull PsiElement classNameIdentifier, @NotNull ModPsiUpdater updater) { final PsiElement parent = classNameIdentifier.getParent(); if (!(parent instanceof PsiClass aClass)) { return; } if (hasImplicitConstructorUsage(aClass)) { updater.cancel(InspectionGadgetsBundle.message("utility.class.without.private.constructor.cant.generate.constructor.message")); return; } final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(project); final PsiElementFactory factory = psiFacade.getElementFactory(); final PsiMethod constructor = factory.createConstructor(); final PsiModifierList modifierList = constructor.getModifierList(); modifierList.setModifierProperty(PsiModifier.PRIVATE, true); aClass.add(constructor); final CodeStyleManager styleManager = CodeStyleManager.getInstance(project); styleManager.reformat(constructor); }