-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
P4
-
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) {
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) {
- relates to
-
JDK-8300857 State return value for Types.asElement(NoType) explicitly
-
- Resolved
-
-
JDK-8284315 DocTrees.getElement is inconsistent with Elements.getTypeElement
-
- Open
-