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

use of 'class' as a property in named-property calling syntax

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0-beta-3
    • None
    • None

    Description

      The following works

      groovy> foo = new Expando()
      groovy> foo.class = { println("Called with ${it}") }
      groovy> foo.class("hey!")
      groovy>
      Called with hey!

      however the following fails

      groovy> foo = new Expando(foo:123, class:'hello')
      groovy> foo
      groovy>
      Caught: org.codehaus.groovy.syntax.parser.UnexpectedTokenException: null:1: <identifier> expected but found "class" 'class'
      org.codehaus.groovy.syntax.parser.UnexpectedTokenException: null:1: <identifier> expected but found "class" 'class'
      at org.codehaus.groovy.syntax.parser.Parser.consume(Parser.java:1965)
      at org.codehaus.groovy.syntax.parser.Parser.rootNode(Parser.java:2069)
      at org.codehaus.groovy.syntax.parser.Parser.namedParameterList(Parser.java:1628)
      at org.codehaus.groovy.syntax.parser.Parser.parameterList(Parser.java:1599)
      at org.codehaus.groovy.syntax.parser.Parser.newExpression(Parser.java:1671)

      Attachments

        Activity

          People

            Unassigned Unassigned
            jstrachan James Strachan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: