Jex Jexler created GROOVY-8720:
----------------------------------
Summary: 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
{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
(v7.6.3#76005)