DocTrees.getElement(DocTreePath) returns javac-internal Symbols

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P4
    • 27
    • Affects Version/s: 11, 12
    • Component/s: tools
    • None

      If a DocTreePath points to a primitive type or other type that does not have a corresponding element, e.g. as in `{@link byte}`, then DocTrees.getElement(DocTreePath) will return the javac-internal ClassSymbol for `byte`, but should probably return `null`.

      For reference, `Elements.getTypeElement(CharSequence)` returns null, by filtering out javac-internal symbols.

      Related, DocTrees.getElement returns the element for the base component type of an array, but should probably return `null`.

      Related, should check out the following methods that return type elements from strings

      src/java.compiler/share/classes/javax/lang/model/util//Elements.java: TypeElement getTypeElement(CharSequence name);
      src/java.compiler/share/classes/javax/lang/model/util//Elements.java: default TypeElement getTypeElement(ModuleElement module, CharSequence name) {
      src/java.compiler/share/classes/javax/lang/model/util//Elements.java: default Set<? extends TypeElement> getAllTypeElements(CharSequence name) {

            Assignee:
            Hannes Wallnoefer
            Reporter:
            Jonathan Gibbons
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: