boolean (@Nullable PsiClass psiClass) { if (psiClass == null) return false; // currently, we use dummy psi class "_Array_" to represent arrays which is an inner of package-private _Dummy_ class. if (PsiUtil.isArrayClass(psiClass)) return true; PsiFile containingFile = psiClass.getContainingFile(); if (containingFile instanceof PsiJavaFile) { if (((PsiJavaFile)containingFile).getPackageName().isEmpty()) { // consider classes in the default package as inaccessible return false; } } while (psiClass != null) { if (!psiClass.hasModifierProperty(PsiModifier.PUBLIC)) { return false; } psiClass = psiClass.getContainingClass(); } return true; }