RFR: 8371248: Crash in -Xdoclint with invalid @link [v3]

Hannes Wallnöfer hannesw at openjdk.org
Thu Nov 13 13:58:16 UTC 2025


On Thu, 13 Nov 2025 10:47:12 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:
> 
>   Fixing test.

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 41:

> 39: import com.sun.source.tree.MemberSelectTree;
> 40: import com.sun.source.tree.ParameterizedTypeTree;
> 41: import com.sun.source.tree.PrimitiveTypeTree;

These imports are no longer needed since you removed the respective visitor methods.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28272#discussion_r2523563668


More information about the javadoc-dev mailing list