protected static boolean needPublicAccess(final PsiClass outerClass, final PsiElement targetContainer) {
    if (outerClass.isInterface()) {
      return true;
    }
    if (targetContainer instanceof PsiDirectory) {
      final PsiPackage targetPackage = JavaDirectoryService.getInstance().getPackage((PsiDirectory)targetContainer);
      final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(outerClass.getProject());
      if (targetPackage != null && !psiFacade.isInPackage(outerClass, targetPackage)) {
        return true;
      }
    }
    return false;
  }
protected static boolean needPublicAccess(final PsiClass outerClass, final PsiElement targetContainer)