On Sat, 5 Nov 2022 22:23:23 GMT, Rémi Forax <fo...@openjdk.org> wrote:

>> Jim Laskey has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Internalize FormatConcatItem
>
> 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>`.

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

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

Reply via email to