<i18n dev> RFR: JDK-8285932 Implementation of JEP 430 String Templates (Preview) [v21]

Jim Laskey jlaskey at openjdk.org
Wed Nov 16 17:33:38 UTC 2022


On Wed, 16 Nov 2022 15:27:47 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Wrong line separator
>
> src/java.base/share/classes/java/lang/template/StringTemplate.java line 38:
> 
>> 36: 
>> 37: /**
>> 38:  * The Java compiler produces implementations of {@link StringTemplate} to
> 
> I believe this descripton is now out of date - the compiler doesn't create implementations of StringTemplate, TemplateRuntime does -  the compiler just request them.

Changing.

`{@link StringTemplate StringTemplates} are runtime representations of Java string templates and text block templates`

> src/java.base/share/classes/java/lang/template/StringTemplate.java line 49:
> 
>> 47:  * The {@link StringTemplate#fragments()} method must return an immutable
>> 48:  * {@code List<String>} consistent with the string template body. The list
>> 49:  * contains the string of characters preceeding each of the embedded expressions
> 
> Suggestion:
> 
>  * contains the string of characters preceding each of the embedded expressions

Changing.

> src/java.base/share/classes/java/lang/template/StringTemplate.java line 73:
> 
>> 71:  * {@code values} will be the equivalent of <code>List.of(x, y, x + y)</code>.
>> 72:  * <p>
>> 73:  * {@link StringTemplate StringTemplates} are primarily used in conjuction
> 
> Suggestion:
> 
>  * {@link StringTemplate StringTemplates} are primarily used in conjunction

Changing.

> src/java.base/share/classes/java/lang/template/StringTemplate.java line 106:
> 
>> 104:  * }
>> 105:  *
>> 106:  * @implSpec An instance of {@link StringTemplate} is immutatble. Also, the
> 
> Suggestion:
> 
>  * @implSpec An instance of {@link StringTemplate} is immutable. Also, the

Changing.

> src/java.base/share/classes/java/lang/template/StringTemplate.java line 138:
> 
>> 136:      * Returns an immutable list of embedded expression results. In the example:
>> 137:      * {@snippet :
>> 138:      * StringTemplate st = RAW."\{x} + \{y} = \{x + y}";
> 
> Would it make sense to use the same student/teacher example as above? Or, perhaps, we should use x and y everywhere?

At least for the fragments and values snippets. Changing.

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

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


More information about the i18n-dev mailing list