+1 for do it right, no matter if the api breaks or not
Am 07.06.2008 um 09:20 schrieb Igor Vaynberg:
so i tried to remove the generic type from component in
sandbox/ivaynberg/wicket-generics branch and ran into what i think is
a deal breaker for this design
class component {
public void setmodel(imodel<?> model) {...}
public imodel<?> getmodel();
}
that is all good until you want to have a generified subclass eg a
listitem:
class listitem<t> extends component {
public imodel<t> getmodel() { return (imodel<t>)super.getmodel(); }
<== works like a charm
public void setmodel(imodel<t> model) {..} <== woops, compilation
error
Name clash: The method setModel(IModel<T>) of type ListItem<T> has the
same erasure as
setModel(IModel<?>) of type MarkupContainer but does not override it
unfortunately the error makes sense and there is no way around it.
same goes for setmodelobject(). i think this makes this design variant
pretty useless. as long as we have the model coupled to component i
dont see a clean way of doing this :(
class listitem<t> extends component {
public imodel<t> getmodel(..);
public void setmodel(imodel<?> model);
}
looks half baked and broken by design
i would almost reconsider 1.4 and its scope and opt to include a model
decoupling (however and if that is possible) refactor in it. otherwise
i fear we will break the whole generics model again in 1.5 and users
will have to relearn how to use them with wicket.
so as far as i can see, and this is only my opinion, our options are:
continue 1.4 as it is now with fully typed components
remove component type but make the api ugly ( i will let matej
explain )
attempt to fix 1.4 by decoupling model from component - 1.4 takes a
lot longer and is not a simple "drop-in/upgrade/whatever"
thoughts and ideas?
-igor
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]