RFR: 8284315: DocTrees.getElement is inconsistent with Elements.getTypeElement

Vicente Romero vromero at openjdk.org
Thu Feb 26 17:34:22 UTC 2026


On Thu, 26 Feb 2026 17:18:50 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:

>> src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java line 518:
>> 
>>> 516:         }
>>> 517: 
>>> 518:         ClassSymbol sym = (ClassSymbol) types.skipTypeVars(type, false).tsym;
>> 
>> I could be wrong but this `types.skipTypeVars` invocation should be unnecessary. `tsym` should always be the erased version. I have found another instance of this pattern in javadoc which probably can be removed too
>
> You are right for the common case where `type` is a parameterized class. But `type` could itself be a type variable, in which case we need to convert it to a class for the member lookup. I'm adding a comment to make the purpose of this clear.

right makes sense

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/29547#discussion_r2860382413


More information about the javadoc-dev mailing list