String (@Nullable PsiClass aClass, boolean constructor) { String modifier = PsiModifier.PUBLIC; if (aClass != null && (!aClass.isRecord() || constructor) && !aClass.isInterface()) { if (aClass.hasModifierProperty(PsiModifier.PACKAGE_LOCAL) || constructor && aClass.isEnum()) { // enum constructors are implicitly private modifier = PsiModifier.PACKAGE_LOCAL; } else if (aClass.hasModifierProperty(PsiModifier.PRIVATE)) { modifier = PsiModifier.PRIVATE; } else if (aClass.hasModifierProperty(PsiModifier.PROTECTED) || constructor && aClass.hasModifierProperty(PsiModifier.ABSTRACT) && aClass.hasModifierProperty(PsiModifier.PUBLIC)) { modifier = PsiModifier.PROTECTED; } } return modifier; }