Jaggregate with BGGA closures

The latest snapshots of Jaggregate seem to work well with BGGA closures converted to functors and predicates. I had to extract one-method interfaces from the abstract *Function and *Predicate classes (the interfaces are "*Functor" and "*Condition") -- they basically correspond to the single abstract evaluate() and matches() methods -- and to change method signatures to accept the interface types rather than the abstract class types. This was to allow closure conversion to occur -- if the parameters remained of types corresponding to abstract classes, the conversions would be rejected.

The one tweak needed was that initially, the BGGA prototype (dated Apr 27 2008) was rejecting calls such as:


    Interval.fromTo(1, 4).forEachDo(System.out#println(int));

where the closure (here, a method reference) passed as a UnaryFunctor had return type void, and the signature of forEachDo() was:


    void forEachDo(UnaryFunctor<? super Integer, ?>);

If I changed the signature to:


    <R> void forEachDo(UnaryFunctor<? super Integer, ? extends R>);

things were fine, but I wasn't sure why the change would be necessary.

I mailed Neal Gafter about this, and seemingly within hours he'd fixed the issue and released a new cut of the prototype (dated May 11 2008). Many thanks to Neal for the quick turnaround and for fighting through my silly questions. :)

Written on May 14, 2008