groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <eric.mil...@thomsonreuters.com>
Subject Selection of DGM from multiple options
Date Sat, 18 Nov 2017 14:39:38 GMT
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


Mime
View raw message