On Fri, 20 Jan 2023 18:47:54 GMT, Justin Lu <j...@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

Reply via email to