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

Isaac Dooley commented on GROOVY-7284:
--------------------------------------

Here is a simple example that fails to compile in 2.5.2, but compiles 
successfully in 2.4.15.
{code:java}
final Object v
try {
     v = "hello world"
} catch (Exception e) {
     throw new RuntimeException("goodbye")
}

println v{code}
 
{code:java}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
./test2.groovy: 8: The variable [v] may be uninitialized
. At [8:9] @ line 8, column 9.
println v
^

1 error
{code}

> final variable declaration is broken 
> -------------------------------------
>
>                 Key: GROOVY-7284
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7284
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.5.0-beta-1
>         Environment: Debian Sid, Groovy master head
>            Reporter: Russel Winder
>            Priority: Major
>
> .../Gant/src/main/groovy/gant/Gant.groovy: 128: The variable [fileText] is 
> declared final but is reassigned
> . At [128:7]  @ line 128, column 7.
>          final fileText = url.text
>          ^
> 1 error
> This is a brand new error the code used to compile just fine. For the 
> avoidance of doubt:
> $ grep fileText `find src -name "*.groovy"` 
> src/main/groovy/gant/Gant.groovy:      final fileText = url.text
> src/main/groovy/gant/Gant.groovy:      compileScript(cacheDirectory, 
> fileText, className)
> src/main/groovy/gant/Gant.groovy:      return 
> binding.groovyShell.parse(fileText, buildClassName)
> the variable is not in fact reassigned.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to