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

Jim Laskey jlaskey at openjdk.org
Thu Mar 23 12:16:39 UTC 2023


On Wed, 22 Mar 2023 23:23:38 GMT, Chen Liang <liach at openjdk.org> wrote:

>> Jim Laskey has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Tidy javadoc
>>  - Rename StringTemplate classes
>
> src/java.base/share/classes/java/lang/StringTemplate.java line 679:
> 
>> 677:     @PreviewFeature(feature=PreviewFeature.Feature.STRING_TEMPLATES)
>> 678:     @FunctionalInterface
>> 679:     public interface StringProcessor extends SimpleProcessor<String> {
> 
> Just curious, what's the rationale of a `SimpleProcessor` or `StringProcessor` as opposed to:
> 
> static <T> TemplateProcessor<T, RuntimeException> simple(Function<StringTemplate, T> function) {...}
> static TemplateProcessor<String, RuntimeException> string(Function<StringTemplate, String> function) {...}
> 
> which avoids the requirement of specifying the type of the template processor local variable; users can use `var` instead.

Worth considering. Thank you.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/10889#discussion_r1146091987


More information about the i18n-dev mailing list