On Wed, 12 Jul 2023 16:40:53 GMT, Jonathan Gibbons <j...@openjdk.org> wrote:
>> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java >> line 2120: >> >>> 2118: >>> 2119: public List<? extends DocTree> getBlockTags(Element element, >>> String tagName) { >>> 2120: return getBlockTags(element, >> >> For this or a later PR: >> >> 1. Even prior to this PR that `instanceof` seemed redundant. If we don't >> want to change the `getBlockTags(Element, Predicate)` return type to >> BlockTagTree, I suggest to downcast unconditionally: >> >> t -> ((BlockTagTree) t).getTagName().equals(tagName)); >> >> 2. After this PR, the only client of the BaseTaglet.accepts method would be >> SimpleTaglet, which we should move that method to. > > Good observation. I looked at this. Ideally, all the `Utils.getBlockTags` methods should return `List<? extends BlockTagTree>` but such a change leaks into the public API at `DocCommentTree.getBlockTags`. This *may* be a hangover related to handling `ErroneousTree`, _but I didn't dig deep enough to find out_. Yes, `DocCommentParser` may include `ErroneousTree` here. That's not to say that `Utils` should not filter out those nodes, but this is getting too far afield for this PR. Filed: [JDK-8311974](https://bugs.openjdk.org/browse/JDK-8311974) Clean up Utils.getBlockTags ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14793#discussion_r1261679908