Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

These benefits are a great asset to Wicket. Wicket uses the concept of models to provide components with the data that needs to be rendered. Until recently Wicket was Java 1.4 based, and a lot of components suffered from the lack of generified models. Take for instance the ListView:

Generics Suck!

TBD

Suggestion 1 - setResponsePage() signature

The initial issue that started this discussion was a problem with this method signature:

Code Block

        public final void setResponsePage(final Class<? extends Page<?>> cls, PageParameters parameters)
	{
		getRequestCycle().setResponsePage(cls, parameters);
	}

We could change this to:

Code Block

        @SuppressWarnings({"unchecked"})
        public final void setResponsePage(final Class<?> cls, PageParameters parameters)
	{
                final Class<? extends Page<?>> castCls = (Class<? extends Page<?>> cls)
		getRequestCycle().setResponsePage(castCls, parameters);
	}

This way (a) users migrating to 1.4 don't get tons of warnings/errors and (b) if they pass in the wrong thing, a class cast exception will be thrown quickly.

NOTE: This is just an example - we may wish to move the cast into the getRequestCycle() call ...

My idea is to dial back the generics on some of the API calls like this one and others that cause pain, but leave the generics for useful things like getModelObject().

-Doug Donohoe