No the HomePage cant be raw type anymore more
So it must be typed.. Why that is..?
<? extends Page<?>>

then the last <?> seem to say that for that Class it must be filled in with
a real Type
So it must be HomePage extends Page<String>

and you can't do:

foo.bar(Component<String>.class)

because that doesnt mean anything
So

HomePage<T> extends Page<T>

then homePage class is still raw type

and HomePage extends Page<String>

then the class it self is generified

and somehow <?> in a class definition does apply only to a Generified class
not a raw type class.

I think it is all in that area that it is a Class..

johan





On Fri, Jun 6, 2008 at 1:31 PM, Martin Funk <[EMAIL PROTECTED]>
wrote:

> 2008/6/6 Sebastiaan van Erk <[EMAIL PROTECTED]>:
>
> > Martin Funk wrote:
> >
> >> Jeremy Thomerson wrote:
> >>
> >>> I haven't read the whole thread, but you should be fine as long as your
> >>> returned page class uses generics...
> >>>
> >>> Here's what I use in one app, no warnings, no casts:
> >>>
> >>>    @Override
> >>>    public Class<? extends Page<?>> getHomePage() {
> >>>        return Home.class;
> >>>    }
> >>>
> >>>
> >>> public class Home extends WebPage<Void> {
> >>> }
> >>>
> >>>
> >>>
> >> Hi Jeremy,
> >>
> >> I'm still picking on the words. What do you mean by 'uses generics'?
> >>
> >> I think the point is class Home has to be a non generic type subclassing
> >> the generic class WebPage with a concrete type parameter.
> >>
> >
> > Why should the HomePage class be "non generic", and why should you use a
> > "concrete type parameter"?
>
> I'm not good in explaining why HomePage has to be non generic yet, but
> there
> seems to be experimental evidence, see:
>
> http://cwiki.apache.org/confluence/display/WICKET/generics#generics-Variationsof%27publicvoidfoo%28Class%3C%3FextendsComponent%3C%3F%3E%3Eclazz%29%27
>
> But the given class Home definitely is not generic!
>
>
> >
> > Class<? extends Page<?>> means "class of (anything that extends (page of
> > anything))".
>
> I'm not so sure.
>
> >
> >
> > That means your home page can have as many type parameters as you wish
> (or
> > none at all), as long as it extends Page<?>. This also means you you can
> > define a generic HomePage like this:
> >
> > class HomePage<T> extends WebPage<T> { ... }
>
> see
>        foo.bar(Component.class);
>        foo.bar(IntegerComponent.class);
>        foo.bar(GenericComponent.class);
>        foo.bar(GenericIntegerComponent.class);
> in the given example page above.
>
> >
> >
> > if you feel like it, and don't have to use a concrete type.
>
> But if you chose to make class HomePage non-generic you have to decide on a
> concrete type parameter for WebPage.
>
> >
> >
> > And I still really don't understand why java has a problem with this:
> >
> > class HomePage extends WebPage { ... }
> >
> > since here it *is still* the case that HomePage is a subtype of
> WebPage<?>
> > (you prove this by the assignment:
> >
> > WebPage<?> wp = new HomePage();
> >
> > which works fine). So you would expect to be able to return this in the
> > getHomePage() method. But you can't because the compiler chokes on it. I
> > have not seen a convincing reason why this shouldn't work yet, though.
>
> Me neither, but we are working on it.
>
> Martin
>
> >
> >
> > Regards,
> > Sebastiaan
> >
> >  mf
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
>

Reply via email to