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

Pavel Rappo prappo at openjdk.java.net
Fri Oct 29 12:43:16 UTC 2021


On Fri, 29 Oct 2021 11:01:44 GMT, Pavel Rappo <prappo at openjdk.org> wrote:

>> Remember it's just a convenience/default mapping to create a language attribute without explicitly setting it. File extensions do not change over night, so I think the only risk here is missing out on some newly popular language or carrying some obsolete language that nobody will use (well I guess latex may fall in that category :)
>> 
>> 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.
>> 
>> I also thought about keeping the list minimal, but then it's just a little nod at anyone who may be using one of these languages.
>
> 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`.

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

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


More information about the javadoc-dev mailing list