On Wed, 9 Nov 2022 21:55:24 GMT, Rémi Forax <fo...@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