On Fri, 12 Jan 2024 22:41:46 GMT, Justin Lu <j...@openjdk.org> wrote:

>> Please review this PR which implements toString() for the `Format` 
>> subclasses. Corresponding CSR: 
>> [JDK-8323088](https://bugs.openjdk.org/browse/JDK-8323088)
>> 
>> The general specification follows a template that provides the locale (if 
>> the class is localized) and any relevant patterns. The specification was 
>> intentionally kept minimal and deliberately worded as "for debugging".
>> 
>> An example of all the classes has output such as 
>> 
>> 
>> CompactNumberFormat [locale: "English (United States)", decimal pattern: 
>> "foo#0.00#baz", compact patterns: "[, , , {one:0K other:0K}, {one:00K 
>> other:00K}, {one:000K other:000K}, {one:0M other:0M}, {one:00M other:00M}, 
>> {one:000M other:000M}, {one:0B other:0B}, {one:00B other:00B}, {one:000B 
>> other:000B}, {one:0T other:0T}, {one:00T other:00T}, {one:000T other:000T}]"]
>> 
>> DecimalFormat [locale: "English (United States)", pattern: "foo#0.00#baz"]
>> 
>> SimpleDateFormat [locale: "Chinese (China)", pattern: "EEE, MMM d, ''yy"]
>> 
>> ListFormat [locale: "English (United States)", start: "{0}, {1}", middle: 
>> "{0}, {1}", end: "{0}, and {1}", two: "{0} and {1}", three: "{0}, {1}, and 
>> {2}"]
>> 
>> MessageFormat [locale: "Chinese (China)", pattern: "foo {0}"]
>> 
>> ChoiceFormat [pattern: "0#foo"]
>
> Justin Lu has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   remove quotes around locale when equal to null

Marked as reviewed by rriggs (Reviewer).

src/java.base/share/classes/java/text/MessageFormat.java line 1195:

> 1193:             """
> 1194:             MessageFormat [locale: %s, pattern: "%s"]
> 1195:             """.formatted(locale == null ? null : 
> '"'+locale.getDisplayName()+'"', toPattern());

Style wise, operators (like "+") should have spaces around them.

src/java.base/share/classes/java/text/SimpleDateFormat.java line 2433:

> 2431:             """
> 2432:             SimpleDateFormat [locale: %s, pattern: "%s"]
> 2433:             """.formatted(locale == null ? null : 
> '"'+locale.getDisplayName()+'"', toPattern());

Ditto, add spaces around +.

test/jdk/java/text/Format/DateFormat/ToStringTest.java line 59:

> 57:     public void oddValueTest() {
> 58:         String expectedStr =
> 59:                 "SimpleDateFormat [locale: 
> \""+Locale.getDefault().getDisplayName()+"\", pattern: \"MMM d, y\"]\n";

Add spaces around operator +

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

PR Review: https://git.openjdk.org/jdk/pull/17355#pullrequestreview-1839039270
PR Review Comment: https://git.openjdk.org/jdk/pull/17355#discussion_r1463432450
PR Review Comment: https://git.openjdk.org/jdk/pull/17355#discussion_r1463433138
PR Review Comment: https://git.openjdk.org/jdk/pull/17355#discussion_r1463434281

Reply via email to