RFR: JDK-8309566: Migrate away from TagletWriter and TagletWriterImpl [v3]

Jonathan Gibbons jjg at openjdk.org
Wed Jul 12 20:25:20 UTC 2023


On Wed, 12 Jul 2023 16:36:05 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:

>> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java line 1391:
>> 
>>> 1389:                 @Override
>>> 1390:                 protected Boolean defaultAction(DocTree node, Content content) {
>>> 1391:                     if (node instanceof InlineTagTree) {
>> 
>> As far as I understand, the deleted `visit{DocRoot, Index, Link, Literal, Summary, SystemProperty}` are routed here (i.e. `defaultAction`).
>> 
>> While I'm not against it, that `instanceof` seems unnecessary; did you add it for readability?
>
> My recollection is that this was just defensive.  I'll investigate.

Yes, it's a defensive measure.  The visitor is being called with a `List<? extends DocTree>`. Non-tag nodes should already be handled. A different defensive measure would be to `assert node instanceof InlineTagTree`. Yet another variant would be to change this to an `instanceof` pattern, and modify the signature of `getInlineTagOutput` to require an `InlineTagTree`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14793#discussion_r1261686764


More information about the javadoc-dev mailing list