RFR: 8341904: Search tag in inherited doc comment creates additional index item

Hannes Wallnöfer hannesw at openjdk.org
Tue Oct 29 14:57:27 UTC 2024


Please review a change to avoid generation of index items for comments inherited from overridden methods. This affects `{@index}`, `{@systemProperty}`, and `@spec` tags in both implicitly and explicitly doc comments. 

The change adds two additional means for avoiding generation of index items which partially overlap:

 - Adding the `inheritDoc` tag to the current `TagletWriter.Context` when rendering an inherited doc comment
 - Comparing the element's type element with the type element currently being documented

The second check is necessary for implicitly inherited doc comments (e.g. overriding a method without doc comment), while usage of `{@inheritDoc}` tag is detected by checks. I still decided to add the `inheritDoc` tag constant to `TagletWriter.Context` since it is explicit, uses a mechanism that was created for the purpose, and might be useful in other places. 

There was a test case for the previous (buggy) behaviour to add a search tag index item using the overridden method signature as label. I changed the expected behaviour and added another method to cover usage of the `{@systemProperty}` tag in combination with `{@inheritDoc}`.

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

Commit messages:
 - Update copyright header
 - 8341904: Search tag in inherited doc comment creates additional index item

Changes: https://git.openjdk.org/jdk/pull/21765/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=21765&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8341904
  Stats: 61 lines in 5 files changed: 31 ins; 15 del; 15 mod
  Patch: https://git.openjdk.org/jdk/pull/21765.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/21765/head:pull/21765

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


More information about the javadoc-dev mailing list