Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Critical
-
Resolution: Cannot Reproduce
-
Affects Version/s: 1.6.3
-
Fix Version/s: 1.6.4, 1.7-beta-1
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
The following code when run in Groovy console produces no output whatsoever:
interface Callback { def execute(); } def test(Callback callable) { println "crap" } test({ throw new Exception("ugly")} as Callback, true)
The reason is the logic that formulates the message for the MissingMethodException is invoking the passed closure resulting in the exception contained within the closure being thrown and the original root cause being swallowed.
Just to add I have no idea why Groovy is invoking user defined closures passed as arguments to the method when constructing the MissingMethodException but it seems like a completely braindead idea to me. Groovy should never invoke user defined code in the construction of error messages that could potentially consume other errors.