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

Cannot set static final property

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Won't Fix
    • 1.5.7
    • None
    • syntax
    • None
    • Windows XP SP3, GroovyConsole

    Description

      On a static final list property, add can be called but not +=. On a static list property both operators work fine.

      groovy> class Globals

      { groovy> static final lst = [] groovy> static lst2 = [] groovy> }

      groovy> Globals.lst2.add(1)
      groovy> Globals.lst.add(1)
      groovy> Globals.lst2 += 2
      groovy> Globals.lst += 2

      Exception thrown: groovy.lang.ReadOnlyPropertyException: Cannot set readonly property: lst for class: Globals

      groovy.lang.ReadOnlyPropertyException: Cannot set readonly property: lst for class: Globals
      at Script8.run(Script8:11)

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            klaus.kopruch@materna.de Klaus Kopruch
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: