groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alessio <aless...@gmail.com>
Subject Re: "External" closures, why?
Date Tue, 01 Dec 2015 21:05:04 GMT
On Tue, Dec 1, 2015 at 9:48 PM, Winnebeck, Jason
<Jason.Winnebeck@windstream.com> wrote:
> The explicit cast was needed before 2.2 only when you were trying to cast a Closure to
an instance of an interface (or other SAM type). In my example, the closure implicitly can
be casted to type X after 2.2. Before 2.2, you had to explicitly cast the closure to X.
>
> Jochen's example worked because he didn't declare the type of his parameter. When no
type is declared, "Object" is used, which will take the Closure directly.

So before 2.2 the cast was necessary in order to satisfy the method
signature argument-wise, with a single Object argument being the
default (and hence not requiring a cast)? Did I get that right?

Mime
View raw message