<i18n dev> RFR: JDK-8285932 Implementation of JEP-430 String Templates (Preview) [v3]
Rémi Forax
forax at openjdk.org
Mon Oct 31 07:17:49 UTC 2022
On Sat, 29 Oct 2022 00:56:18 GMT, ExE Boss <duke at openjdk.org> wrote:
>> 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>`.
Ok, get it.
I still see not reason to have this method being public given that this is equivalent to `Template.of(fragments, values).interpolate()`.
The less methods in the API, the better.
-------------
PR: https://git.openjdk.org/jdk/pull/10889
More information about the i18n-dev
mailing list