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

Daniel Sun updated GROOVY-8444:
-------------------------------
    Component/s: Static compilation

> Support unqualified enum constants in switch cases (like Java)
> --------------------------------------------------------------
>
>                 Key: GROOVY-8444
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8444
>             Project: Groovy
>          Issue Type: Improvement
>          Components: Static compilation
>            Reporter: Eric Milles
>            Assignee: Daniel Sun
>            Priority: Major
>             Fix For: 3.0.0-rc-1
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Would it be possible to support this syntax that Java requires for enum 
> constants in switch statements?
> {code:java}
> enum SomeEnum { A, B }
> void meth(SomeEnum e) {
>   switch (e) {
>   case A: // currently this must be qualified, like SomeEnum.A
>     ...
>     break
>   case B:
>     ...
>     break
>   }
> }
> meth(someEnumValue) // currently throws MissingPropertyException: No such 
> property: A for class...
> {code}
> P.S. As we need to check whether the switch-case is for enum, type info is 
> required, so it only works when STC is enabled.



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

Reply via email to