On Wed, 12 Nov 2025 17:26:00 GMT, Jan Lahoda <[email protected]> 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`).
test/langtools/tools/javac/doctree/ReferenceTest.java line 90:
> 88: * {@link double#NAN Bad}
> 89: * {@link double#double Bad}
> 90: * {@link java.base/double Bad}
I also some crashes in non-primitive examples like
* {@link List<String>.of}
* {@link Optional<String>.empty}
* {@link Map<String, Integer>.Entry}
This PR also fixes them, but maybe consider adding more tests like that, unless
it's already covered?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28272#discussion_r2519258043