RFR: JDK-8306578: Report error if no label given in @see and {@link} when no default is available [v2]
Jonathan Gibbons
jjg at openjdk.org
Tue May 30 23:59:59 UTC 2023
On Fri, 5 May 2023 17:40:20 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:
>> Hannes Wallnöfer has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits:
>>
>> - Merge branch 'master' into JDK-8306578
>> - JDK-8306578: Report error if no label given in @see and {@link} when no default is available
>
> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java line 503:
>
>> 501: // A non-empty label is required for fragment links as the
>> 502: // reference target does not provide a useful default label.
>> 503: htmlWriter.messages.error(ch.getDocTreePath(refTree), "doclet.link.see.no_label");
>
> This is ... interesting.
> This method is called from various places, which is why we pass in a function to report diagnostics in the appropriate way for the caller (meaning, at the appropriate position.). It seems less than ideal to avoid using the function, but that being said, this codepath likely cannot occur in the most problematic situation, in snippets.
>
> I'm not (yet) sure what the right approach is here. Maybe we can move away from needing the `reportWarning` function. See PR #13811 for a separate PR in this area.
>
> Maybe/probably the better (future?) solution is to pass in the tree path for `refTree` instead of (just) `refTree` by itself. This could/should be used in all diagnostics and world obviate the need for the `reportWarning` function. It would still require a TODO in the snippet code, to replace the existing TODO to provide the function for `reportWarning`.
Filed https://bugs.openjdk.org/browse/JDK-8309158
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13720#discussion_r1210948173
More information about the javadoc-dev
mailing list