code: public boolean isAccessible(@Nonnull JavaModelElement e) {
          if (!(e instanceof JavaMethodParameterElement) && !isAccessibleByModifier(e.getDeclaringElement())) {
              return false;
          }
  
          JavaModelElement parent = e.getParent();
  
          if (e instanceof JavaTypeElement) {
              return ((JavaTypeElement) e).isInAPI() && (parent == null || _isAccessible(parent));
          } else {
              assert parent != null;
              return isAccessible(parent);
          }
      }
docs: This method checks that the provided element and all its parent elements are accessible (public or protected).
  Additionally, if the provided element is a type, it must be in API or, if it is not a type, its nearest enclosing
  type must be in API.
  
  @param e the element to check
  @return true if the provided element is accessible and in API, false otherwise.