RFR: 8332039: Cannot invoke "com.sun.source.util.DocTreePath.getTreePath()" because "path" is null
Pavel Rappo
prappo at openjdk.org
Fri May 31 09:23:02 UTC 2024
On Thu, 30 May 2024 18:43:28 GMT, Pavel Rappo <prappo at 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.
>
> I understand the solution and see how it logically parallels the existing link between `getDocTreePath` and inheritable taglets. That said, I dislike the solution, but also cannot propose a better one at this time. The logic is repeated and spread out.
> @pavelrappo raises an interesting point. nested classes do not "inherit" from their enclosing class, and so putting the fix in a method dealing with inheritance seems wrong.
>
> Either the fix should be moved or the method renamed.
To clarify, I'm not too concerned with how we call an action whereby a nested class gets its `@since` tag from the enclosing class; but yes, "inheritance" might not be ideal. What I'm concerned with is the fact that the logic originally provided in [`getDefaultBlockTags`][getDefaultBlockTags] is now duplicated in `getInheritedDocTreePath`.
Like I said, while it's bad, the new duplication merely replicates the one we already have between `InheritableTaglet.inherit` and `getInheritedDocTreePath`.
[getDefaultBlockTags]: https://github.com/openjdk/jdk/blob/6ee8407758c92d32e18642b0758d2d5c71ad09f5/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/SimpleTaglet.java#L141-L147
-------------
PR Comment: https://git.openjdk.org/jdk/pull/19363#issuecomment-2141579378
More information about the javadoc-dev
mailing list