<i18n dev> RFR: 8300706: Use @snippet in java.text [v2]

Naoto Sato naoto at openjdk.org
Fri Jan 20 19:00:26 UTC 2023


On Fri, 20 Jan 2023 18:47:54 GMT, Justin Lu <jlu at openjdk.org> wrote:

>> Some classes / interfaces in java.text have already implemented JEP 413.
>> 
>> This PR implements _JEP 413: Code Snippets in Java API Documentation_ for the rest of [java.text](https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/text/package-summary.html) including:
>> - BreakIterator
>> - CharacterIterator
>> - DateFormatSymbols
>> - DecimalFormat
>> - NumberFormat 
>> 
>> Code examples using <pre> ... </pre> blocks are replaced with the @ snippet syntax where applicable.
>
> Justin Lu has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Drop strong font, put comment back in snippet

Your changes look good. I'd clean up the examples themselves taking this opportunity.

src/java.base/share/classes/java/text/DecimalFormat.java line 75:

> 73:  * <blockquote>{@snippet lang=java :
> 74:  * NumberFormat f = NumberFormat.getInstance(loc);
> 75:  * if (f instanceof DecimalFormat) {

Pattern matching `instanceof` should be used.

src/java.base/share/classes/java/text/DecimalFormat.java line 373:

> 371:  *     }
> 372:  * }
> 373:  * }</pre></blockquote>

The example here can utilize enhanced `switch` and pattern matching `instanceof`.

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

PR: https://git.openjdk.org/jdk/pull/12121


More information about the i18n-dev mailing list