RFR: 8281533: Odd "preview" label in link/linkplain

Hannes Wallnöfer hannesw at openjdk.org
Mon Aug 19 14:43:57 UTC 2024


Please review a patch to suppress the `PREVIEW` and `RESTRICTED` superscript labels for JavaDoc tags that generate plain links such as `{@linkplain ...}`. The rationale is that the purpose of plain links is usually to have the label not "stick out" of the local context, which makes the superscript label look odd. 

The fix itself consists of a single line in `LinkTaglet.java`. The major part of the changed lines is to clean up the generation of `PREVIEW` and `RESTRICTED` labels in `HtmlLinkFactory.java`, which I have wanted to do for a long time. Instead of generating internal and external links and plain-text labels in separate code, I have moved the code to a common method that will generate the appropriate link or label. It is a bit of a code smell that the `getSuperscript` method uses nullness of parameters to decide which link format to use, but I didn't know any reasonably simple better way to do this. I did add proper doc comments to explain what is returned even though the code is private.

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

Commit messages:
 - Add test
 - JDK-8281533: Odd "preview" label in link/linkplain

Changes: https://git.openjdk.org/jdk/pull/20626/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20626&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8281533
  Stats: 104 lines in 4 files changed: 62 ins; 31 del; 11 mod
  Patch: https://git.openjdk.org/jdk/pull/20626.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20626/head:pull/20626

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


More information about the javadoc-dev mailing list