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

Short syntax of closure call invokes wrong closure if wrapped in another closure and @CompileStatic is applied

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.7
    • Fix Version/s: 2.4.13
    • Component/s: Static compilation
    • Labels:
      None

      Description

      The following would fail:

      import groovy.transform.CompileStatic
      
      @CompileStatic
      class Foo {
           Closure c = { "ok" }
           Closure wrap = {
               c()
           }
      
           def run(){
               wrap()
           }
      }
      
      assert new Foo().run()​ == "ok"  // stack overflow
      

      It works fine without CompileStatic or if invokation is done by c.call()

        Attachments

          Activity

            People

            • Assignee:
              jwagenleitner John Wagenleitner
              Reporter:
              krzysztof.kowalczyk Krzysztof Kowalczyk
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: