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

STC: closure param's default not type-checked (method target)

    XMLWordPrintableJSON

Details

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

    Description

      Consider the following:

      void setFoo(java.util.function.Consumer<Number> c) {}
      @groovy.transform.TypeChecked
      void test(Date d) {
        foo = { n = d -> }
      }
      

      The default value expression "d" is not compatible with the Number parameter "n". There is no type-checking error for the call case. Direct assignment is checked: "java.util.function.Consumer<Number> c = { n = new Date() -> }" and "def bar = { Number n = d -> }"

      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: