RFR: 8342808: Javadoc should add whitespace between type parameters [v4]
Hannes Wallnöfer
hannesw at openjdk.org
Mon Nov 25 17:22:21 UTC 2024
On Fri, 22 Nov 2024 18:05:36 GMT, Nizar Benalla <nbenalla at openjdk.org> wrote:
>> EDIT: Here are the [generated docs](https://cr.openjdk.org/~nbenalla/GeneratedDocs/8342808/docs/api/index.html) after the latest changes.
>>
>> Please review this patch to render javadocs as `<K, V, T>` rather than `<K,V,T>` to match naming conventions and make the rendered output slighly nicer to read.
>>
>> Passes langtool tests.
>>
>> The [generated docs](https://cr.openjdk.org/~nbenalla/GeneratedDocs/K-V-space/docs/api/index.html) only include `java.base`.
>>
>> Note for reviewers:
>>
>> In `TestInheritence`, B is a user defined class and `TypeMirror::getKind` returns `DECLARED `. Which why we see this output.
>>
>>
>>
>> html
>>
>> Class D<R,S>
>> java.lang.Object
>> [pkg.A](https://htmledit.squarefree.com/A.html)<S, [B](https://htmledit.squarefree.com/B.html)>
>> [pkg.B](https://htmledit.squarefree.com/B.html)<S, [B](https://htmledit.squarefree.com/B.html)>
>> pkg.D<R,S>
>
> Nizar Benalla has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision:
>
> - Merge remote-tracking branch 'upstream/master' into javadoc-whitespace
> - update tests
> - use a simpler approach to decide whether to add spaces or not
>
> remove code related to adding new lines for very long methods (only used a couple of times in the JDK)
> - Merge remote-tracking branch 'upstream/master' into javadoc-whitespace
> - small improvement after getting review comments.
>
> Update tests
> - Merge remote-tracking branch 'upstream/master' into javadoc-whitespace
> - Add small whitespace before map parameters
This looks good to me. The threshold of 8 characters is a bit arbitrary, but it seems reasonable.
A few minor issues:
- Since we don't really check for bounded type parameters but only for length I suggest renaming the boolean variable to something like `longTypeParams`.
- The length threshold should be defined as a constant in a way that both `ClassWriter` and `HtmlLinkFactory` can use it.
- The old `TYPE_PARAMS_MAX_INLINE_LENGTH` constant in `Signatures` isn't used anymore and should be removed.
-------------
Changes requested by hannesw (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/21759#pullrequestreview-2459057706
More information about the javadoc-dev
mailing list