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

[Antlr2]Parser error for enum constant with comma followed by method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.17, 2.5.8, 3.0.0-rc-1
    • 3.0.0-rc-2
    • None

    Description

      Consider the following:

      enum Orientation {
        LANDSCAPE, PORTRAIT,
        
        @Override
        String toString() {
           name().toLowerCase().capitalize()
        }
      }
      
      println Orientation.values()
      

      Parser error "unexpected token" for comma after PORTRAIT. Remove comma and no issue. Parsers support enum with trailing comma (no class members).

      See also GROOVY-4438 and GROOVY-8507

      Attachments

        Issue Links

          Activity

            People

              emilles Eric Milles
              emilles Eric Milles
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: