Open bmorris591 opened 8 years ago
Would you like to submit a pull request to fix that issue?
I'm facing this issue right now.
:+1: to this feature
@olafleur sorry; haven't had much time recently - I'll try and push something before next week.
No worries. If you need help in the process, just ping us here!
OrderedSlot
should probably have the following signature:This is because it is currently impossible to have a common generic baseclass for widgets that need to be members of an
OrderedSlot
.Consider the following example (sorry, it's quite horrible):
So the
View
,PresenterWidget
,OrderedSlot
,UIHandlers
,ViewWithUiHandlers
emulate existing GWTP classes.I have added a custom base presenter
class BasePresenter
which is generic in theUIHandlers
and theViewWithUiHandlers
. It also isComparable
to itself.Now, in order for another
Presenter
to have aSlot
that accepts presenters extending this base class, I would need to followingOrderedSlot
declaration:But this will result in a compiler error:
This is because the compiler cannot find type bounds on the wildcards
?, ?
such that the self type& Comparable<T>
is satisfied. And this makes sense, as if I create two extension classes and add them both to theOrderedSlot<BasePresenter<?, ?>>
Then as
PresenterOne implements Comparable<BasePresenter<SomeUiHandlers, ViewWithUiHandlers<SomeUiHandlers>>
andPresenterTwo implements Comparable<BasePresenter<OtherUiHandlers, ViewWithUiHandlers<OtherUiHandlers>>
the type equality constraint is violated.In order for this situation to work, the type constraint on
OrderedSlot
needs to be relaxed.