Hello there,

I'm a Wicket Virgin (hm ;-) and have just started to look at Wicket 1.4. It 
seems something is wrong with the generics changes there. I have a page which 
itself has a model: a CompoundPropertyModel<SomeClass>. Most basic Wicket 
components are generic: things like Label need a type parameter specifying 
the model (which by the way makes for very verbose coding). But the whole 
Page hierarchy gets defined hard as a MarkupContainer<Object>. This renders 
the setModel() calls on Page unusable because they in turn also expect 
IModel<Object>'s, and not IModel<? extends Object>. This makes it impossible 
to pass any Model into a Page-derived object without making use of a complex 
cast:

  setModel((IModel<Object>)  (Object) new CompoundPropertyModel<BuilderState>( 
bs));

This only works because of the utterly idiotic way that Generics are 
implemented in Java (type erasure; usability erasure would be a better name 
8-(), and even there you need to watch out: Eclipse will silently remove the 
above cast and then generate a compilation error 8-(

It looks like thinks like Page should also be generic (which looks like 
crap)...

Or I'm doing something wrong, of course ;-)

Frits

-- 
DRM: Digital Restrictions Management -- learn about the dangers at 
http://www.defectivebydesign.org/what_is_drm

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to