The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

geobei (2) [Avatar] Offline
#1
The mixin example 8.21 (EvenSieve ...) fails as type information of the returned this refers to the mixin class.
This can be avoided by coercing this to another type that is only compatible to the mixin target type. So obviously
return (this as List)
works, but reduces usability of mixin classes to List.
More generally, the following work also:
return (this as Collection)
and even
return (this as Serializable)
Mittie (397) [Avatar] Offline
#2
Thanks for posting.

I'm not quite sure which Groovy version you tested with but the code (now listing 8.22) works fine with Groovy 2.4.

keep groovin'
Dierk