RFR: 8300706: Use @snippet in java.text

Justin Lu jlu at openjdk.org
Fri Jan 20 18:05:08 UTC 2023


On Fri, 20 Jan 2023 17:41:35 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.

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

> 341:  * <blockquote><pre><strong>{@code
> 342:  * // Print out a number using the localized number, integer, currency,
> 343:  * // and percent format for each locale}</strong>{@code

This comment is originally in strong font within the code example. Replacing both instances of `@ code` with `@ snippet` will just create two separate snippet blocks, one for the comment and one for the code which does not seem ideal.

To maintain the strong font, the comment has to be outside of the code snippet.

If that's not desirable, I think some alternatives are

- Leave the comment in the code snippet and get rid of the strong font 
- Keep the strong font but convert the comment into a normal text description

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

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


More information about the core-libs-dev mailing list