[ 
https://issues.apache.org/jira/browse/GROOVY-9306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17952125#comment-17952125
 ] 

Eric Milles commented on GROOVY-9306:
-------------------------------------

If I recall, there were some trailing comma cases that did work.  But to deal 
with the annotated method, I looked at what was possible and then compared to 
what Java supports.  There are a few cases of trailing comma that worked 
previously that will not work under this new grammar.

This might be the clearest example:
{code:groovy}
// GROOVY-9301
enum E10 {
    X(1), Y(2), // trailing comma
    ; // added this to test case
    Object value
    E10(value) {
        this.value = value
    }
}
{code}

> 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