String (@NotNull PsiModifierListOwner psiElement) { if (psiElement instanceof PsiParameter) return PsiModifier.PACKAGE_LOCAL; PsiModifierList list = psiElement.getModifierList(); String result = PsiModifier.PACKAGE_LOCAL; if (list != null) { if (list.hasModifierProperty(PsiModifier.PRIVATE)) { result = PsiModifier.PRIVATE; } else if (list.hasModifierProperty(PsiModifier.PROTECTED)) { result = PsiModifier.PROTECTED; } else if (list.hasModifierProperty(PsiModifier.PUBLIC)) { result = PsiModifier.PUBLIC; } else if (psiElement.getParent() instanceof PsiClass ownerClass && ownerClass.isInterface()) { result = PsiModifier.PUBLIC; } } return result; }