Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-7992

Sort methods that accept a comparator should accept Comparator<? super T> (fix type checker ability to cope with super in DGM methods)

Agile BoardAttach filesAttach ScreenshotVotersStop watchingWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.7
    • 4.0.7, 3.0.20
    • groovy-jdk
    • None

    Description

      Methods like org.codehaus.groovy.runtime.DefaultGroovyMethods.sort(Iterable<T>, boolean, Comparator<T>) and all the others alike should be changed to accept a Comparator<? super T>, otherwise if you use @CompileStatic you'll get compiler errors as soon as you try to sort an Iterable/Collection using a comparator that accept superclass instances.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            emilles Eric Milles
            mauromol Mauro Molinari
            Votes:
            0 Vote for this issue
            Watchers:
            3 Stop watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment