[
https://issues.apache.org/jira/browse/GROOVY-8720?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Daniel Sun reassigned GROOVY-8720:
----------------------------------
Fix Version/s: 7.0.0-alpha-1
Assignee: Daniel Sun
> final variable set in try fails to compile if throws in catch
> -------------------------------------------------------------
>
> Key: GROOVY-8720
> URL: https://issues.apache.org/jira/browse/GROOVY-8720
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 2.5.1
> Reporter: Jex Jexler
> Assignee: Daniel Sun
> Priority: Minor
> Fix For: 7.0.0-alpha-1
>
>
> {code:java}
> final Date date = new Date()
> final Long ms
> try {
> ms = date.parse('')
> } catch (IllegalArgumentException e) {
> throw new RuntimeException(e)
> }
> println ms
> {code}
> Expected result (Groovy 2.4.15):
> {noformat}
> Java.lang.RuntimeException: java.lang.IllegalArgumentException
> at ConsoleScript0.run(ConsoleScript0:6)
> Caused by: java.lang.IllegalArgumentException
> at java_util_Date$parse.call(Unknown Source)
> at ConsoleScript0.run(ConsoleScript0:4)
> {noformat}
> Fails to compile with Groovy 2.5.1:
> {noformat}
> The variable [ms] may be uninitialized
> . At [8:9] at line: 8, column: 9
> {noformat}
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)