Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.6-rc-1
-
Fix Version/s: 1.6-rc-2, 1.5.8, 1.7-beta-1
-
Component/s: Compiler
-
Labels:None
-
Number of attachments :
Description
Unlike Java, Groovy allows try statements without a catch or finally block:
class TryWithoutCatchOrFinally {
static void main(args) {
try
}
}
Execution of such a try statement just executes the try block (it doesn't swallow exceptions). The following discussion seems to come to the conclusion that it would be better to follow Java and raise a syntax error: http://www.nabble.com/Try-statement-without-catch-or-finally-block-td21542131.html
I completely agree, there is no point in a try {} w/o a catch {} or finally {}.