private static boolean isPublicApi(@NotNull PsiClass psiClass) {
    if (psiClass.hasModifierProperty(PsiModifier.PUBLIC) || psiClass.hasModifierProperty(PsiModifier.PROTECTED)) {
      final PsiElement parent = psiClass.getParent();
      return parent instanceof PsiJavaFile || parent instanceof PsiClass && isPublicApi((PsiClass)parent);
    }
    return false;
  }
private static boolean isPublicApi(@NotNull PsiClass psiClass)