RFR: JDK-8290243: move seeTagToContent from HtmlDocletWriter to TagletWriterImpl [v2]
Jonathan Gibbons
jjg at openjdk.org
Thu Jul 21 20:42:13 UTC 2022
On Thu, 21 Jul 2022 20:37:35 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:
>> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java line 471:
>>
>>> 469: String tagName, boolean isLinkPlain,
>>> 470: Content label,
>>> 471: BiConsumer<String, Object[]> reportWarning) {
>>
>> This method is huge: it has 8 parameters and spans 120 lines. We should refactor it in a later PR. For now, consider the below suggestion that changes access level, addresses a few doc typos, and formats parameters one per line.
>>
>> Suggestion:
>>
>> /**
>> * Worker method to generate a link from the information in different kinds of tags,
>> * such as {@code {@link ...}} tags, {@code @see ...} tags and the {@code link} markup tag
>> * in a {@code {@snippet ...}} tag.
>> *
>> * @param holder the element that has the documentation comment containing the information
>> * @param refTree the tree node containing the information, or {@code null} if not available
>> * @param refSignature the normalized signature of the target of the reference
>> * @param ref the target of the reference
>> * @param tagName the name of the tag in the source, to be used in diagnostics
>> * @param isLinkPlain {@code true} if the link should be presented in "plain" font,
>> * or {@code false} for "code" font
>> * @param label the label for the link,
>> * or an empty content to use a default label derived from the signature
>> * @param reportWarning a function to report warnings about issues found in the reference
>> *
>> * @return the output containing the generated link, or content indicating an error
>> */
>> private Content linkSeeReferenceOutput(Element holder,
>> DocTree refTree,
>> String refSignature,
>> Element ref,
>> String tagName,
>> boolean isLinkPlain,
>> Content label,
>> BiConsumer<String, Object[]> reportWarning) {
>
> Yes, it's a big method; my defense is that it is smaller than before!
>
> I'm open to further refactoring if anything obvious becomes apparent.
I will make the proposed suggestions.
-------------
PR: https://git.openjdk.org/jdk/pull/9499
More information about the javadoc-dev
mailing list