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

Rémi Forax forax at openjdk.org
Wed Nov 2 17:50:00 UTC 2022


On Tue, 1 Nov 2022 18:22:07 GMT, Jim Laskey <jlaskey at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/template/TemplateRuntime.java line 119:
>> 
>>> 117:         Class<?> tsClass = st.getClass();
>>> 118:         if (tsClass.isSynthetic()) {
>>> 119:             try {
>> 
>> I do not know if this code is worth of optimizing but the way to avoid to recompute the List<Class<?>> each time is to use a java.lang.ClassValue and store the classes inside an unmodifiable List. (Field[] -> Class<?>[] -> List<Class<?>>) The last leg can be done just by calling List.of(), there is no need for an ArrayList here
>
> Will use List.of. I think use case is raw and caching should be left to the user.

i agree

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

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


More information about the i18n-dev mailing list