RFR: 8371248: Crash in -Xdoclint with invalid @link

Jan Lahoda jlahoda at openjdk.org
Wed Nov 12 17:33:15 UTC 2025


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`).

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

Commit messages:
 - Cleanup.
 - Whitespace tweak.
 - More tests
 - More conservative fix.
 - 8371248: Crash in -Xdoclint with invalid @link

Changes: https://git.openjdk.org/jdk/pull/28272/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28272&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8371248
  Stats: 13 lines in 3 files changed: 10 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/28272.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28272/head:pull/28272

PR: https://git.openjdk.org/jdk/pull/28272


More information about the javadoc-dev mailing list