RFR: JDK-8275788: Create code element with suitable attributes for code snippets [v3]

Hannes Wallnöfer hannesw at openjdk.java.net
Fri Oct 29 14:01:47 UTC 2021


On Fri, 29 Oct 2021 12:39:46 GMT, Pavel Rappo <prappo at openjdk.org> wrote:

>> Separately. After b97ea5b, the CI (test/langtools/tools/javac/NoStringToLower.java) complains about that `switch` using String.toLowerCase without explicit locale. We have multiple options here (should we clean that up in a separate PR?):
>> 
>> - Specify the locale (`Locale.US`) (sometimes we specify Locale.ROOT)
>> - Use jdk.javadoc.internal.doclets.toolkit.util.Utils.toLowerCase
>> - Use com.sun.tools.javac.util.StringUtils.toLowerCase
>
>> I thought about (adding a comment about) making the mapping configurable, but I think any such mechanism would be much more complicated than just adding a "lang" attribute to your snippets.
> 
> If only we had a way to reuse a default taglet rather than completely replace it, then this could be solved by simply providing an `@snippet` taglet with custom mappings: `-taglet ExtendedSnippetTaglet`.

I went with jdk.javadoc.internal.doclets.toolkit.util.Utils.toLowerCase. If there is an existing nearby method that solves the problem I guess we should use it.

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

PR: https://git.openjdk.java.net/jdk/pull/6165


More information about the javadoc-dev mailing list