Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: 1.0, 1.1-beta-1
-
Fix Version/s: 1.1-beta-2
-
Component/s: None
-
Labels:None
-
Environment:Ubuntu Linux 6.10, Java SE 6, Groovy 1.1 Beta 1
-
Testcase included:yes
-
Number of attachments :
Description
When using a try-finally block in methods with return values then the finally block will not always be executed.
Here's a script which demonstrates the problem:
boolean foo () {
try {
println "try"
// only when next line is removed then the finally-block will be executed
if (0 == 1) return false
return true
}
finally {
println "finally"
}
}
foo ()
Output after starting: eddie@saringnb:~$ groovy test.groovy
try
Finally will only be executed when removing the line " if (0 == 1) return false".
I've reported a similar problem for Groovy 1.0 (http://jira.codehaus.org/browse/GROOVY-1663), probably it was not solved completely.
BTW: Is there a planning for a bugfix release (e.g. 1.0.1) without new features which just removes these critical bugs? Would be important for production usage.
Thanks in advance,
Stefan
I've attached the test script. It's the same as in the bug description, but unfortunately the newlines were removed in the description text.