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

Static type checks for closure parameters of methods

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.0-beta-1
    • 4.0.0
    • Static Type Checker
    • None

    Description

      Static type checker should check calls to closure parameters with provided @ClosureParams information:

      @CompileStatic
      void foo(@ClosureParams(value = FromString, options = "java.lang.Number") 
               Closure cl) { 
          cl("a") //Compilation should fail here
      }
      
      

      Of course, these checks are not applicable to reassigned parameters, but in most cases closure parameters are not reassigned.

      Attachments

        Activity

          People

            emilles Eric Milles
            mxm-groovy Maxim Medvedev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: