RFR: 8371248: Crash in -Xdoclint with invalid @link [v4]
Hannes Wallnöfer
hannesw at openjdk.org
Thu Nov 13 15:16:21 UTC 2025
On Thu, 13 Nov 2025 14:25:04 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
>> The attribution of javadoc links fails with an NPE if the link is like `{@link double.NAN Bad}` - it tries to dereference the `double`, which obviously cannot work.
>>
>> This PR mostly just adds checks that will stop the attribution, and return `null`.
>>
>> Note that for `{@link double Class}` the existing code does not crash and returns the internal a `TypeElement` corresponding to the `double`. This is a weird quirk of this API, and is preserved with this PR (although a test is added for it into `test/langtools/tools/javac/doctree/ReferenceTest.java`).
>
> Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision:
>
> Removing unnecessary imports as suggested.
Looks good to me.
test/langtools/tools/javac/doctree/ReferenceTest.java line 111:
> 109: * {@link java.base/java.util.Map<String, String>.Entry<String, String>.getKey Bad}
> 110: * {@link java.base/java.util.Map<String, String>.Entry<String, String>#getKey Bad}
> 111: * {@link java.base/java.util.Map<String, String>.Entry<String, String>#setValue(Object) Bad}
Is there a reason parameterized types don't work with modules, or is it just an implementation quirk? Not that it matters much as it is a rather unlikely corner case.
-------------
Marked as reviewed by hannesw (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/28272#pullrequestreview-3460274938
PR Review Comment: https://git.openjdk.org/jdk/pull/28272#discussion_r2523845287
More information about the javadoc-dev
mailing list