groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Harvey <>
Subject Re: Lack of a wild card in DefaultGroovyMethods
Date Thu, 11 Jan 2018 22:23:56 GMT
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

public static <T, X extends T> T[] plus(T[] left, X[] right) { ... }

What do you guys think about this?

Sent from:

View raw message