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

STC: error for addAll with collect argument

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.5
    • Fix Version/s: 4.0.0-alpha-1, 3.0.6
    • Component/s: None
    • Labels:
      None

      Description

      Follow up from GROOVY-9734 and GROOVY-8961. New STC error for generics mismatch when pairing collect with a method pointer:

      interface Service {
        Number transform(String s)
      }
      @groovy.transform.TypeChecked
      void test(Service service) {
        Set<Number> numbers = []
        List<String> strings = ['x','y','z']
        numbers.addAll(strings.collect(service.&transform)) // Cannot call java.util.Set <Number>#addAll(java.util.Collection <? extends java.lang.Number>) with arguments [java.util.List <? extends E>]
      }
      

        Attachments

          Activity

            People

            • Assignee:
              emilles Eric Milles
              Reporter:
              emilles Eric Milles
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h
                1h