You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2019/11/03 15:56:00 UTC

[jira] [Created] (GROOVY-9301) Parser error for enum constant with comma followed by method

Eric Milles created GROOVY-9301:
-----------------------------------

             Summary: Parser error for enum constant with comma followed by method
                 Key: GROOVY-9301
                 URL: https://issues.apache.org/jira/browse/GROOVY-9301
             Project: Groovy
          Issue Type: Bug
          Components: parser-antlr2, parser-antlr4
    Affects Versions: 3.0.0-rc-1, 2.5.8, 2.4.17
            Reporter: Eric Milles


Consider the following:
{code:groovy}
enum Orientation {
  LANDSCAPE, PORTRAIT,
  
  @Override
  String toString() {
     name().toLowerCase().capitalize()
  }
}

println Orientation.values()
{code}

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



--
This message was sent by Atlassian Jira
(v8.3.4#803005)