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

Jim Laskey jlaskey at openjdk.org
Mon Oct 31 13:49:20 UTC 2022


On Fri, 28 Oct 2022 19:57:41 GMT, Rémi Forax <forax at openjdk.org> wrote:

>> `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)));
>> }
>
> Yes, it only occurs to me mid review, that said there is already an implementation in the jdk of a compact immutable that allow null inside the JDK (this implementation is used when stream.toList() is used).
> Using that implementation will avoid a bunch of indirection

Changing to use `JUCA`.

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

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


More information about the compiler-dev mailing list