RFR: JDK-8267219: Javadoc method summary breaks when {@inheritDoc} from an empty parent [v2]

Hannes Wallnöfer hannesw at openjdk.java.net
Tue May 18 14:36:44 UTC 2021


On Mon, 17 May 2021 17:39:19 GMT, liach <github.com+7806504+liach at openjdk.org> wrote:

>> This change fixes when a method body has only inline tags that produce no output, the method summary will get eaten.
>> 
>> This change allows `{@inheritDoc}` from empty parents to go through the code path used by `-nocomment` and properly generate tables.
>> 
>> All `jtreg:test/langtools/jdk/javadoc/doclet` tests pass.
>
> liach has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR.

Thanks for looking into this and doing all the detective work, @liach! 

Your fix is a viable workaround, but I think we must fix the problem in `Table.java`, which is caused by the maybe surprising behaviour of `isEmpty()` and `isValid()` in `HtmlTree`. At least I find it surprising that a `<div>` with attributes but no content is considered empty but not valid. 

But regardless of this question, the only safe fix is to replace the `!isEmpty()` check in line 331 of `Table.java` with an `isValid()` check. It's a bit counter-intuitive that a div with an attribute and no content will be "lost" in the process,  and maybe the implementation of `HtmlTree.isValid()` should be changed to consider that as valid. But the important thing is to make the `Table` class safe against similar problems in the future.

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

Changes requested by hannesw (Reviewer).

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


More information about the javadoc-dev mailing list