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

@Field variable can't be referred from closure

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8-rc-1
    • Fix Version/s: 1.8-rc-4
    • Component/s: None
    • Labels:
      None
    • Environment:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: