[ 
https://issues.apache.org/jira/browse/GROOVY-9306?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles resolved GROOVY-9306.
---------------------------------
    Fix Version/s: 5.0.0-alpha-11
       Resolution: Fixed

https://github.com/apache/groovy/commit/65506f4c5808e9625a93aee8c71523c2ced1739a

I went with the solution that most closely matches Java and eliminates 
ambiguity.  A constant-only {{enum}} can have a trailing comma.  An {{enum}} 
with constants and members requires no comma plus a newline or a semicolon for 
separation.

> error for enum constant with comma followed by method
> -----------------------------------------------------
>
>                 Key: GROOVY-9306
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9306
>             Project: Groovy
>          Issue Type: Bug
>          Components: parser-antlr4
>    Affects Versions: 3.0.0-rc-1
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>              Labels: breaking, enum
>             Fix For: 5.0.0-alpha-11
>
>
> 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).
> See also GROOVY-4438, GROOVY-7773 and GROOVY-8507



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to