I must say if this works, it has my +1000 support. Martijn
On Wed, May 21, 2008 at 3:01 PM, Joni Freeman <[EMAIL PROTECTED]> wrote: > > On Wed, 2008-05-21 at 14:44 +0200, Sebastiaan van Erk wrote: >> Martijn Dashorst wrote: >> > Generified component touches *ALL* code in Wicket, wether you care or >> > not. IModel<T> itself is rather contained. >> >> Yes, but in my opinion rather useless as well. Plus you get heaps of >> @SuppressWarnings all over the place. Then just get rid of generics >> completely... > > In which case would you need @SuppressWarnings? Consider for instance: > > interface IModel<T> { > } > > class Component { > private IModel<?> model; > > public <T> IModel<T> getModel() { > return (IModel<T>) model; > } > } > > class MyComp extends Component { > public MyComp() { > IModel<Integer> model = getModel(); > } > } > > This compiles and the only warning is within wicket code. There's an > unsafe cast to IModel<T>. Of course this would mean that getModel and > getModelObject could throw classcastexception. It's a tradeoff: simple > and more conservative usage of generics vs. fully type safe but complex > and verbose usage of generics. > > Joni > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Buy Wicket in Action: http://manning.com/dashorst Apache Wicket 1.3.3 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]