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

Can not use the syntax obj.@name in the left hand side of assgnment operators (=, +=, *=, etc)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-JSR-1, 1.0-JSR-2, 1.0-JSR-3, 1.0-JSR-4
    • 1.0-JSR-4
    • None
    • None

    Description

      The attached example AttributeSetAccessError fails on
      JSR-01 or JSR-02 or JSR-03 or CVS HEAD (JSR-04-SNAPSHOT).

      assert SomeClass.@name != SomeClass.name // fails on JSR-01

      Here is the generated error message:
      AttributeSetAccessError.groovy: 13:
      class org.codehaus.groovy.ast.expr.AttributeExpression, with its value 'new null
      (()).name', is a bad expression as the LSH of an assignment operator at line: 13
      column: 31. File: AttributeSetAccessError.groovy @ line 13, column 31.
      new SomeClass().@name = "changed bar" // fails but should work
      ^

      1 Error

      Attachments

        1. AttributeSetAccessError.groovy
          0.9 kB
          Kim, Pilho

        Activity

          People

            phkim Kim, Pilho
            phkim Kim, Pilho
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: