Paul King created GROOVY-9438:
---------------------------------
Summary: CLONE - Incorrect handling of final variables within
switch
Key: GROOVY-9438
URL: https://issues.apache.org/jira/browse/GROOVY-9438
Project: Groovy
Issue Type: Bug
Reporter: Daniel Wilmer
Assignee: Paul King
Fix For: 2.5.10, 3.0.2
The following code runs on groovy 2.4.18 but not on groovy 3.0.1.
{code}
static void main(String[] args) {
final String result
switch (2) {
case 1: result = "a"; break;
case 2: result = "b"; break;
default: result = "x"
}
println result
}
{code}
*Error: Groovyc: The variable [result] is declared final but is reassigned.*
Since we use final in our codebase a lot (although it seems to be ignored by
groovy 2.4),
we will have to adjust a lot of places to make our code groovy 3.0 compatible.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)