<i18n dev> RFR: JDK-8285932 Implementation of JEP 430 String Templates (Preview) [v21]
Tagir F. Valeev
tvaleev at openjdk.org
Wed Nov 16 21:21:42 UTC 2022
On Wed, 16 Nov 2022 20:25:30 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 202:
>
>> 200: @SuppressWarnings({"unchecked", "varargs"})
>> 201: private static <E> List<E> toList(E... elements) {
>> 202: return Collections.unmodifiableList(Arrays.asList(elements));
>
> Is a defensive copy needed here?
> The caller of `newStringTemplate` could retain a reference to the Object[] array and modify it later.
Alternatively, `SharedSecrets.getJavaUtilCollectionAccess().listFromTrustedArrayNullsAllowed(elements)` (or `elements.clone()`) could be used here, to reduce amount of wrappers.
-------------
PR: https://git.openjdk.org/jdk/pull/10889
More information about the i18n-dev
mailing list