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

ExE Boss duke at openjdk.org
Sat Oct 29 01:03:23 UTC 2022


On Fri, 28 Oct 2022 19:13:54 GMT, Rémi Forax <forax at openjdk.org> wrote:

>> Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update TemplateRuntime::combine
>
> src/java.base/share/classes/java/lang/template/StringTemplate.java line 323:
> 
>> 321:      * @throws NullPointerException fragments or values is null or if any of the fragments is null
>> 322:      */
>> 323:     public static String interpolate(List<String> fragments, List<Object> values) {
> 
> This method also exists has a static method, having both is a bad idea because it makes StringTemplate::interpolate a compile error, the compiler has no way to know that it's the same implementation.

Actually, `StringTemplate::interpolate` is fine, as this method takes two parameters, whereas the instance method only takes an implicit `this` parameter.

The instance method is only assignable to `Function<StringTemplate, String>` or `Supplier<String>`, and the static method is only assignable to `BiFunction<List<String>, List<Object>, String>`.

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

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


More information about the i18n-dev mailing list