groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul King <pa...@asert.com.au>
Subject Re: Selection of DGM from multiple options
Date Sat, 18 Nov 2017 22:13:34 GMT
Because the method is @Deprecated it won't be seen as a DGM extension
method, i.e. when used in the normal Groovy way.

If you call the method long-hand or from Java, both versions will be
available. Which reminds me, we were probably going to delete some of those
deprecated methods in Groovy 3.

Cheers, Paul.

On Sun, Nov 19, 2017 at 12:39 AM, <eric.milles@thomsonreuters.com> wrote:

> Could someone help me understand the rules for DGMs when multiple methods
> apply?  I can't seem to find anything in the specification that addresses
> this and I need to emulate (or call into) the rules for Eclipse.  I also
> tried walking through MetaClassImpl and MetaMethodIndex, but I got lost
> in the cache loading code.
>
>
>
> DefaultGroovyMethods defines these two methods, in this order.  At
> runtime, if I have an ArrayList, sort(Iterable,Closure) is the method
> that is called.  Is this because 1) Iterable has wider applicability than
> Collection, 2) the Collection version is deprecated, 3) the Iterable
> version is defined last, or 4) something else?
>
>
>
>     @Deprecated
>
>     public static <T> List<T> sort(Collection<T> self,
> @ClosureParams(value=FromString.class, options={"T","T,T"}) Closure
> closure) {
>
>         ...
>
>     }
>
>
>
>     public static <T> List<T> sort(  Iterable<T> self,
> @ClosureParams(value=FromString.class, options={"T","T,T"}) Closure
> closure) {
>
>         ...
>
>     }
>
>
>
> *Eric Milles*
> Lead Software Engineer
>
> *Thomson Reuters*
>
> Email: eric.milles@thomsonreuters.com
>
> Phone: 651-848-7040 <(651)%20848-7040>
>
>
>

Mime
View raw message