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

Calls to closures declared as fields are not type checked properly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0-beta-2
    • 2.0-beta-3
    • Static Type Checker
    • None

    Description

      If a class contains a field declared as a closure and that you use that closure as a method, the type checker throws a missing method error.

      class FibUtil {
                      private Closure<Integer> fibo
                      FibUtil() {
                          fibo = { int x-> x<1?x:fibo(x-1)+fibo(x-2) }
                      }
      
                      int fib(int n) { fibo(n) }
                  }
      

      Attachments

        Activity

          People

            melix Cédric Champeau
            melix Cédric Champeau
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: