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

[Parrot] error for enum constant with comma followed by method

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.0.0-rc-1
    • Fix Version/s: None
    • Component/s: parser-antlr4
    • Labels:
      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

              • Assignee:
                Unassigned
                Reporter:
                emilles Eric Milles
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: