On Thu, 23 May 2024 10:39:52 GMT, Hannes Wallnöfer <hann...@openjdk.org> wrote:
> Please review a patch to fix a NPE thrown when a `@since` tag inherited by a > nested class contains a nested inline tag. The solution is to make > `CommentHelper.getDocTreePath(DocTree)` able to handle block tags inherited > by nested classes. Marked as reviewed by jjg (Reviewer). src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/CommentHelper.java line 517: > 515: private DocTreePath getInheritedDocTreePath(DocTree dtree) { > 516: Utils utils = configuration.utils; > 517: if (element instanceof ExecutableElement ee) { Technically, it is an official anti-pattern to use `instanceof` on Language Model classes. Yes, it works OK for the JDK implementation of `javax.lang.model`, but it is not necessarily true for all other implementations (with a known instance where it is not the case.) The recommended solution is to either use visitors or test or switch on the `ElementKind`. That all being said, I accept this is in JDK code ... and now that we have pattern-switch available ... ------------- PR Review: https://git.openjdk.org/jdk/pull/19363#pullrequestreview-2089110276 PR Review Comment: https://git.openjdk.org/jdk/pull/19363#discussion_r1621264502