RFR: JDK-8285932 Implementation of JEP 430 String Templates (Preview) [v21]

Jim Laskey jlaskey at openjdk.org
Thu Nov 17 16:24:11 UTC 2022


On Wed, 16 Nov 2022 20:22:54 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Jim Laskey has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Wrong line separator
>
> src/java.base/share/classes/java/lang/template/StringTemplateImplFactory.java line 187:
> 
>> 185:     @Override
>> 186:     public StringTemplate newStringTemplate(List<String> fragments, List<?> values) {
>> 187:         return new SimpleStringTemplate(List.copyOf(fragments), toList(values.stream().toArray()));
> 
> `values.toArray()` returns a new array; no need to stream the list content.
> Alt: `Arrays.asList(values.toArray())`

This is to ensure type Object[]. Ex,. if the user passes in a List<String>.

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

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


More information about the compiler-dev mailing list