Description
The following works when run against the current master branch:
import groovy.transform.* def a = [ 1, 2, 3, 4, 5 ] trait Doubler { @ForceOverride Object next() { super.next() * 2 } } class ListIterator implements Iterator<Integer> { @Delegate Iterator<Integer> iter ListIterator( List<Integer> list ) { iter = list.iterator() } } assert new ListIterator( a ).withTraits( Doubler ).collect() == [ 2, 4, 6, 8, 10 ]
But if you change the Doubler trait to the more correctly typed:
trait Doubler { @ForceOverride Integer next() { super.next() * 2 } }
It isn't used, and the result is [1, 2, 3, 4, 5] instead.
Not sure if this is a bug, or a gap in my understanding, but thought I'd put it here