RFR: JDK-8306578: Report error if no label given in @see and {@link} when no default is available [v2]
Hannes Wallnöfer
hannesw at openjdk.org
Fri Jun 2 14:09:09 UTC 2023
On Tue, 30 May 2023 23:57:23 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:
>> 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
As far as I understand, the considerations about `reportWarning` do not affect this change. Is there anything that should be changed in this PR?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13720#discussion_r1214427143
More information about the javadoc-dev
mailing list