RFR: 8335870: Doclet should default @since of classes with no @since information to that of the enclosing package

Hannes Wallnöfer hannesw at openjdk.org
Tue Oct 8 15:11:59 UTC 2024


On Mon, 9 Sep 2024 16:14:47 GMT, Nizar Benalla <nbenalla at openjdk.org> wrote:

> Please review this change to default the value of `@since` to that of the immediately enclosing package if a class doesn't have the `@since` tag.
> 
> For nested classes, you still need to recursively look for the package so I had to add an extra check.

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/SimpleTaglet.java line 169:

> 167:                         && (e.getEnclosingElement() instanceof PackageElement || isNestedType(e))) {
> 168:                         tags = utils.getBlockTags(getPackageElement(e), a -> a.getKind() == tagKind);
> 169:                 }

Wouldn't this better be done in the `getDefaultBlockTags` method above so we don't have to override `getBlockTags`? 

Also, nitpicking, the static factory method is called `createWithDefaultForNested`, which is not true anymore since also top-level types can now inherit block tags.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20918#discussion_r1792064447


More information about the javadoc-dev mailing list