RFR: 8285470: Improve handling of @inheritDoc [v4]

Jonathan Gibbons jjg at openjdk.java.net
Wed May 4 20:31:02 UTC 2022


On Tue, 3 May 2022 19:30:01 GMT, Pavel Rappo <prappo at openjdk.org> wrote:

>> The only taglet that along with its own tag needs to know the immediately enclosing tag is `InheritDocTaglet`:
>> 
>>     @return {@inheritDoc}
>>     @throws NullPointerException {@inheritDoc}
>>     @param p {@inheritDoc}
>> 
>> However, the immediately enclosing tag is unconditionally passed to all taglets. If we stop passing it and make `InheritDocTaglet` compute it instead, the code becomes cleaner.
>> 
>> While reviewing, particularly note these benefits of the proposed change:
>> 
>>  * taglet-handling code knows less about `@inheritDoc`, and
>>  * `InheritDocTaglet` receives its own tag, not the tag that encloses it
>
> Pavel Rappo has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains ten additional commits since the last revision:
> 
>  - Merge branch 'master' into 8285470
>  - (feedback) typography
>  - Update src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/InheritDocTaglet.java
>    
>    Co-authored-by: ExE Boss <3889017+ExE-Boss at users.noreply.github.com>
>  - (fix) Fix a test failure
>    
>    Fixes a failure in jdk/javadoc/doclet/testInheritDocWithinInappropriateTag/TestInheritDocWithinInappropriateTag.java
>  - (cleanup) Simplify retrieveInheritedDocumentation
>  - (cleanup) Clarify retrieveInheritedDocumentation
>  - (cleanup) Unify specs of commentTagsToContent
>  - Stop passing "holderTag"
>  - (cleanup) Remove useless null check
>    
>    DocFinder.search cannot return null.

OK.

I still have reservations about excessive use of the tree-search methods, especially when the info is already available higher up the call stack. That being said, I agree that it is an improvement to not pass the `holder` down the stack, and this change did trigger an improvement to the tree-search support. If there are performance issues, we can either revert the use of `holder` or find some other way to pass the info down to the taglet, perhaps via the taglet writer (impl).

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

Marked as reviewed by jjg (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/8361


More information about the javadoc-dev mailing list