RFR: JDK-8312445: Array types in annotation elements show square brackets twice [v2]

Pavel Rappo prappo at openjdk.org
Wed Jul 26 10:40:53 UTC 2023


On Wed, 26 Jul 2023 09:11:20 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:

>> Please review a change to fix the representation of array types as values of annotation elements in javadoc-generated documentation.
>> 
>> The primary fix is to avoid generating duplicate `[]` brackets for array types, but there are a few secondary improvements:
>> 
>>  - When linking to a type, only use the type name as link label, appending the `.class` as plain text after the link
>>  - Support linking to the base type of array types, again appending the square brackets and `.class` after the link
>>  - Leave it to the `LinkFactory` code to decide whether to use the qualified or simple type name for a link (uses `isLinkable` instead of `isIncluded`)
>> 
>> There already was some test code for the use of array types in annotation elements in `TestNewLanguageFeatures.java`, but it was disabled with a comment referring to another issue that has long been resolved.
>
> Hannes Wallnöfer has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Address review feedback

test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/pkg1/B.java line 41:

> 39:    arrayClassTest = String[][].class,
> 40:    arrayPrimitiveTest = boolean[].class,
> 41:    classArrayTest = {TypeParameterSubClass[].class, String.class, long[][][].class})

Consider adding multi-dimensional array of `TypeParameterSubClass`, to test link generation. The problem with `long[][][]` is that there's nowhere to link to. The problem with `String[][]` is that JDK source where the `java.lang.String` doc comment resides is unavailable.

Alternatively, you could probably link to platform, so that we could see output for `String[][]`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15019#discussion_r1274767350


More information about the javadoc-dev mailing list