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

@Field access within closure fails with 'BUG! exception in phase 'class generation' in source unit'

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.4
    • 1.8.6, 2.0-beta-3
    • None
    • None

    Description

      Looks like accessing @Field fields inside closures has a problem. Please file a bug.

      ---------------------------------------------
      import groovy.transform.Field

      @Field pomProperties = [:]

      "".each {
      pomProperties[1] = 2
      }
      ---------------------------------------------
      fails with the same error.
      ---------------------------------------------
      Caught: BUG! exception in phase 'class generation' in source unit 'C:\Temp\m2g.groovy' tried to get a variable with the name pomProperties
      as stack variable, but a variable with this name was not created
      ---------------------------------------------

      Attachments

        1. groovy5207B.patch
          2 kB
          Paul King
        2. groovy5207.patch
          41 kB
          Paul King

        Activity

          People

            paulk Paul King
            ray@suliteanu.com Ray Suliteanu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: