On Tue, 1 Nov 2022 18:22:07 GMT, Jim Laskey <jlas...@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