groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Theodorou <blackd...@gmx.org>
Subject Re: Lack of a wild card in DefaultGroovyMethods
Date Fri, 12 Jan 2018 01:05:30 GMT
On 11.01.2018 23:23, Nathan Harvey wrote:
> Hi guys, working on this, but I'm not sure how we should be handling arrays.
> For example, take the following two methods:
> 
> public static <T> Collection<T> plus(Collection<T> left, Collection<T>
> right) { ... }
> public static <T> T[] plus(T[] left, T[] right) { ... }
> 
> The first is an easy fix, as it can be made to a Collection<? extends T> for
> the right variable. But obviously arrays don't allow wildcards. Because of
> the way this function works, it *could* be made to behave similarly, like
> this:
> 
> public static <T, X extends T> T[] plus(T[] left, X[] right) { ... }
> 
> What do you guys think about this?

what is failing now, that will work if you do this change?

bye Jochen

Mime
View raw message