Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8140442

Add getOutermostTypeElement to javax.lang.model utility class

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 18
    • 9
    • core-libs
    • b11
    • generic
    • generic

      This is a useful utility used in the doclet's new api and would be beneficial to other users of javax.lang.model.

      Suggested code:
          public TypeElement getOuterMostTypeElement(Element e) {
              if (e.getKind() == ElementKind.PACKAGE)
                  return null;
              Element encl = e.getEnclosingElement();
              ElementKind kind = encl.getKind();
              if (kind == ElementKind.PACKAGE)
                  return null;
              while (!(kind.isClass() || kind.isInterface())) {
                  encl = encl.getEnclosingElement();
              }
              return (TypeElement)encl;
          }

        There are no Sub-Tasks for this issue.

            darcy Joe Darcy
            ksrini Kumar Srinivasan
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: