<i18n dev> RFR: JDK-8285932 Implementation of JEP-430 String Templates (Preview) [v3]
Rémi Forax
forax at openjdk.org
Mon Oct 31 15:55:28 UTC 2022
On Mon, 31 Oct 2022 13:02:18 GMT, Jim Laskey <jlaskey at openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/template/StringTemplate.java line 149:
>>
>>> 147: * {@return the interpolation of the StringTemplate}
>>> 148: */
>>> 149: default String interpolate() {
>>
>> I wonder if all the default methods should not be better as static methods given that they are not the important part of the API but more side information that may be handy
>
> Actually instance interpolate() is the most important method. Each synthetic StringTemplate gets a specialized interpolate providing performance equivalent to string concat. And, a good percentage of processors will work with the result of interpolate to produce result. Ex. `StringProcessor STR = st -> st.interpolate();` and`TemplateProcessor<JSONObject> JSON = st -> new JSONObject(st.interpolate());`
Interesting !
I believe the javadoc should mention that.
-------------
PR: https://git.openjdk.org/jdk/pull/10889
More information about the i18n-dev
mailing list