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

DGM.retainAll() has wrong generic type on Closure condition

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.3.2
    • 2.3.3
    • groovy-jdk
    • None

    Description

      DGM's retainAll() has this signature:

      public static <T> boolean retainAll(Collection<T> self, @ClosureParams(FirstParam.FirstGenericType.class) Closure<T> condition)
      

      The condition closure is expected to return a boolean or a boolean-ish value, but not the same type as the Collection.

      removeAll() has the correct signature that doesn't specify a return type on the closure:

      public static <T> boolean removeAll(Collection<T> self, @ClosureParams(FirstParam.FirstGenericType.class) Closure condition)
      

      retainAll() still works, but IDEA's syntax highlighting complains when passing in a Closure<Boolean> to retainAll() on a List of other objects.

      Attachments

        Activity

          People

            paulk Paul King
            timkingman Tim Kingman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: