RFR: JDK-8285932 Implementation of JEP-430 String Templates (Preview) [v13]
Jim Laskey
jlaskey at openjdk.org
Wed Nov 9 22:13:43 UTC 2022
On Wed, 9 Nov 2022 21:55:24 GMT, Rémi Forax <forax at openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/template/StringTemplate.java line 276:
>>
>>> 274: * @implNote Contents of both lists are copied to construct immutable lists.
>>> 275: */
>>> 276: public static StringTemplate of(List<String> fragments, List<Object> values) {
>>
>> Should be `StringTemplate of(List<String> fragments, List<?> values) {`
>>
>> The call to List.copyOf() will change the List<?> to List<Object>.
>
>> raw List ?
>
> oops, formatting issue.
>
> The idea is that `values` can be typed `List<?>` because the call to List.copyOf() will take the `List<?>` and return a `List<Object>`.
>
> And as a type of a parameter `List<?>` is better than `List<Object>` because `List<String>` is a subtype of `List<?>` but not a subtype of `List<Object>`.
Got you. Changing.
-------------
PR: https://git.openjdk.org/jdk/pull/10889
More information about the compiler-dev
mailing list