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

STC: assignment of closure with untyped parameter to SAM-type (setter target)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.0.17
    • 3.0.18
    • Static Type Checker
    • None

    Description

      Consider the following:

      void setStrategy(Predicate<Long> tester) {
        assert tester.test(1L)
      }
      strategy = { n -> n instanceof Long }
      

      Compiler error: "Incompatible generic argument types. Cannot assign Predicate<Object> to Predicate<Long>"

      Attachments

        Issue Links

          Activity

            People

              emilles Eric Milles
              emilles Eric Milles
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: