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

a keyword used as name of property should not require quotes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.0
    • 1.6-beta-2
    • parser
    • None
    • n/a

    Description

      The obvious example:

      String.'package'.name

      ... the parser really should be able to clearly determine that a property is a property - and not a keyword.

      Not only does this merely look bad, but it's a source of frustration and error, not to mention difficult to understand/debug for new users to groovy:

      groovy -e "println String.package.name"
      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, script_from_command_line: 1: unexpected token: . @ line 1, column 15.

      ... even if the error was more along the lines of "invalid use of reserved keyword: property", it would still be a source of frustration, not to mention it kind of looks bad from a technical standpoint.

      As per the following thread on groovy users mailing list:

      http://archive.groovy.codehaus.org/user/200701132220.08256.corey_s%40qwest.net

      Attachments

        1. GROOVY-1649.patch
          2 kB
          Paul King

        Activity

          People

            paulk Paul King
            corey_s Corey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: