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

@Field variable can't be referred from closure

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8-rc-1
    • 1.8-rc-4
    • None
    • None
    • Mac OS X

    Description

      attached code

      import groovy.transform.Field
      
      @Field def xxx = 3
      
      foo = {
        println xxx
      }
      
      foo()
      
      

      generate following error:

      Caught: BUG! exception in phase 'class generation' in source unit '/Users/uehaj/tmp/bug.groovy' tried to get a variable with the name xxx as stack variable, but a variable with this name was not created

      Attachments

        1. Fixed_GROOVY-4700.patch
          6 kB
          Cédric Champeau
        2. bug.groovy
          0.1 kB
          UEHARA Junji

        Activity

          People

            paulk Paul King
            uehaj UEHARA Junji
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: