RFR: JDK-8285932 Implementation of JEP 430 String Templates (Preview) [v46]
Jim Laskey
jlaskey at openjdk.org
Thu Mar 23 12:20:04 UTC 2023
On Thu, 23 Mar 2023 01:33:59 GMT, Chen Liang <liach at openjdk.org> wrote:
>> Jim Laskey has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - Tidy javadoc
>> - Rename StringTemplate classes
>
> src/java.base/share/classes/java/lang/runtime/TemplateRuntime.java line 204:
>
>> 202: Object[] values
>> 203: ) throws Throwable {
>> 204: List<Object> asList = Collections.unmodifiableList(new ArrayList<>(Arrays.asList(values)));
>
> Suggestion:
>
> List<Object> asList = List.of(values);
>
> For defensive copy.
> Don't think processors are harmed by the null-hostile behavior of these list, for many template implementations already use null-hostile lists.
The values list can't be null-hostile for the same reason that string concatenation can't be null-hostile. Please point to examples of null-hostile lists (other that fragments) being used in the template code. Apologies if I misinterpreted your meaning.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/10889#discussion_r1146098407
More information about the core-libs-dev
mailing list