[jdk17] RFR: JDK-8259499: Handling type arguments from outer classes for inner class in javadoc [v3]
Jonathan Gibbons
jjg at openjdk.java.net
Tue Jul 13 19:38:16 UTC 2021
On Fri, 9 Jul 2021 15:26:18 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:
>> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java line 1082:
>>
>>> 1080: // Must be a class reference since refClass is not null and refMemName is null.
>>> 1081: if (labelContent.isEmpty()) {
>>> 1082: if (seeText.contains("<")) {
>>
>> Hmmm, string-based checks are generally something of a red-flag, as compared to more abstract methods on appropriate classes. And, this is a string operation on the output of `CommentHelper.getText`. Is there a way that we have may this a more robust test ... for example introduce `CommentHelper.isGeneric(ReferenceTree)` or something like that?
>
> I agree something like `CommentHelper.isGeneric(ReferenceTree)` would be preferable, but that method would have to iterate over enclosing types to find any generic types there, just like the `LinkInfo.linkEnclosingTypes(DeclaredType)` method I have added. So I wonder where a shared method for this could go if not to `Utils` (I shudder to think).
As much as I dislike `Utils` it is probably the correct location in this case. I think of `Utils` as being javadoc-specific enhancements and variations on the Language Model `Elements` and `Types` interfaces.
-------------
PR: https://git.openjdk.java.net/jdk17/pull/195
More information about the javadoc-dev
mailing list