On Fri, 28 Oct 2022 19:21:56 GMT, Rémi Forax <[email protected]> wrote:
>> Jim Laskey has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Update TemplateRuntime::combine
>
> src/java.base/share/classes/java/lang/template/TemplateRuntime.java line 211:
>
>> 209: @SuppressWarnings("unchecked")
>> 210: public static <E> List<E> toList(E... elements) {
>> 211: return Collections.unmodifiableList(Arrays.asList(elements));
>
> This is List.of(), please use List.of() instead
`List.of()` can't be used here, since the elements are nullable, according to
the documentation. But the the returned list can still be modified, by changing
the given `elements` array. The input array must be explicitly copied:
public static <E> List<E> toList(E... elements) {
return Collections.unmodifiableList(new
ArrayList<>(Arrays.asList(elements)));
}
-------------
PR: https://git.openjdk.org/jdk/pull/10889