RFR: JDK-8285932 Implementation of JEP 430 String Templates (Preview) [v28]

Jim Laskey jlaskey at openjdk.org
Tue Nov 22 20:09:11 UTC 2022


On Tue, 22 Nov 2022 18:33:23 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Seal Digits
>
> src/java.base/share/classes/java/lang/template/StringTemplate.java line 52:
> 
>> 50:  * given by the template expression.
>> 51:  * <p>
>> 52:  * For example, the following code contains a template expression that uses the template
> 
> Though this is trying to explain the general mechanism, it might be more useful to readers to start with the most common use case, that of using a string processor. Swapping the order of the examples possibly.

The issue is that most users will not see a StringTemplate object. If they've come here then they want to see the inner workings.

> src/java.base/share/classes/java/lang/template/StringTemplate.java line 63:
> 
>> 61:  * {@code fragments} will be equivalent to {@code List.of("", " + ", " = ", "")},
>> 62:  * which includes the empty first and last fragments. {@code values} will be the
>> 63:  * equivalent of {@code List.of(10, 20, 30)}.
> 
> Find a way to capitalize the first word of the sentence.
> Suggestion:
> 
>  * The value of {@code fragments} will be equivalent to {@code List.of("", " + ", " = ", "")},
>  * which includes the empty first and last fragments. The {@code values} will be the
>  * equivalent of {@code List.of(10, 20, 30)}.

Changing.

> src/java.base/share/classes/java/lang/template/StringTemplate.java line 66:
> 
>> 64:  * <p>
>> 65:  * The following code contains a template expression with the same template but a
>> 66:  * different template processor:
> 
> Suggestion:
> 
>  * The following code contains a template expression with the same template but a
>  * string template processor:

Changing. Missing "with" as well.

> src/java.base/share/classes/java/lang/template/StringTemplate.java line 75:
> 
>> 73:  * produced that returns the same lists from {@link StringTemplate#fragments()} and
>> 74:  * {@link StringTemplate#values()} as shown above. The {@link StringTemplate#STR} template
>> 75:  * processor uses these lists to yield an interpolated string. {@code s} will be equivalent to
> 
> Suggestion:
> 
>  * processor uses these lists to yield an interpolated string. The value of {@code s} will be equivalent to

Changing.

> src/java.base/share/classes/java/util/FormatProcessor.java line 196:
> 
>> 194:      * <a href="../../util/Formatter.html#syntax">format specifier</a>.
>> 195:      * StringTemplate expressions without a preceeding specifier, use "%s" by
>> 196: 
> 
> Its worth specifying the locale that is used by FMT, is it `Locale.ROOT`?
> If it is `Locale.default`, the results may vary from run to run.

Okay.

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

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


More information about the compiler-dev mailing list