jdeferred / jdeferred

Java Deferred/Promise library similar to JQuery.

Home Page:jdeferred.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Substantiating return type for promise.then(DoneFilter) and promise.then(DoneFilter, FailFilter)

sclassen opened this issue · comments

Currently the return type of all then() methods which take filters as argument is a new promise with 3 new generic types. i.e
<D_OUT, F_OUT, P_OUT> Promise<D_OUT, F_OUT, P_OUT> then(DoneFilter<D, D_OUT> doneFilter);

The return type could be more specific because F_OUT must be equal to F and P_OUT must be equal to P. Therefore it could be written as
<D_OUT> Promise<D_OUT, F, P> then(DoneFilter<D, D_OUT> doneFilter);

The same holds for the method then(DoneFilter, FailFilter).

@saturnism
Do you want to consider this issue for the 2.x release. It is a breaking API change and I feel it either should go into 2.x or not at all.
I have most of the work on a branch done and could wrap it up within he next 24 hours

IMHO all breaking chages like this one should go in the 2.x branch. @saturnism ?

+1 @aalmiray

@sclassen thnx for pointing this out, let's get this into 2.0 as well.

merged.