boolean (@Nullable PsiClass aClass) { if (aClass == null || aClass.isInterface() || aClass instanceof PsiTypeParameter || aClass instanceof PsiAnonymousClass) { return false; } if (aClass.isEnum()) { if (!ControlFlowUtils.hasChildrenOfTypeCount(aClass, 1, PsiEnumConstant.class)) { return false; } // has at least on accessible instance method return ContainerUtil.exists(aClass.getMethods(), m -> !m.isConstructor() && !m.hasModifierProperty(PsiModifier.PRIVATE) && !m.hasModifierProperty(PsiModifier.STATIC)); } final PsiMethod[] constructors = getIfOnlyInvisibleConstructors(aClass); if (constructors.length != 1) { return false; } final PsiField selfInstance = getIfOneStaticSelfInstance(aClass); return selfInstance != null && newOnlyAssignsToStaticSelfInstance(constructors[0], selfInstance); }