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

Daniel Sun closed GROOVY-8801.
------------------------------
    Fix Version/s: 3.0.25
         Assignee: Daniel Sun
       Resolution: Fixed

The issue has been fixed in groovy 3.0

> groovyc 2.5 and 3.0 fail to compile code with final variable set in try block
> -----------------------------------------------------------------------------
>
>                 Key: GROOVY-8801
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8801
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 3.0.0-alpha-3, 2.5.2
>            Reporter: Isaac Dooley
>            Assignee: Daniel Sun
>            Priority: Major
>             Fix For: 3.0.25
>
>
> Here is a simple example that fails to compile in 2.5.2 and 3.0.0-alpha3, but 
> compiled successfully in 2.4.15. It seems that groovyc doesn't like that the 
> variable is referenced in an unreachable portion of code should the 
> assignment have never happened.
> {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}



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

Reply via email to