boolean (PsiMember member, PsiElement referencingLocation) { if (member.hasModifierProperty(PsiModifier.PUBLIC)) { return true; } final PsiClass containingClass = member.getContainingClass(); if (containingClass == null) { return false; } final PsiClass referencingClass = ClassUtils.getContainingClass(referencingLocation); if (referencingClass == null) { return false; } if (referencingClass.equals(containingClass)) { return true; } if (member.hasModifierProperty(PsiModifier.PRIVATE)) { return false; } return ClassUtils.inSamePackage(containingClass, referencingLocation); }