yeah.  if Page/WebPage are not going to be generic, maybe they should extend
(Web)MarkupContainer<?> or something?


MYoung wrote:
> 
>> public class HomePage extends WebPage {
> 
> ERROR: The type WebPage is not generic; it cannot be parameterized with
> arguments 
> 
> 
> 
>>you COULD use the @SuppressWarnings({"unchecked"})
> 
> I would rather not use @SupressWarnings if I can do the right thing.
> 
> On Thu, Apr 10, 2008 at 4:49 PM, Matej Knopp <[EMAIL PROTECTED]>
> wrote:
> 
>> Problem is that WebPage is generic class but your instance doesn't
>> have the type specified. Since you page doesn't have a model object
>> the type is not really necessary, but the compiler doesn't know that.
>>
>> You can try this:
>>
>>
>> public class HomePage extends WebPage {
>>
>> This should get rid of the wanings when adding components.
>>
>> -Matej
>>
>> On Fri, Apr 11, 2008 at 1:19 AM, Matthew Young <[EMAIL PROTECTED]> wrote:
>> > Oh mine, some many generic warnings after moving to 1.4.  I got rid of
>> them
>> >  by putting in type parameters but I'm not sure if I'm doing the right
>> thing.
>> >  There is one warning I don't know how to fix:
>> >
>> >  WARNING: Type safety: the method add(Component) belongs to the raw
>> type
>> >  MarkupContainer. Reference to generic type MarkupContainer<T> should
>> be
>> >  parameterized.
>> >
>> >
>> >  What are the benefits of generifying Wicket? I only know one is type
>> safe
>> >  model.  What else?
>> >
>> >
>> >
>> >  Here is a little test page, please take a look and see if I'm doing
>> thing
>> >  correctly?
>> >
>> >  public class HomePage extends WebPage {
>> >
>> >     private static final long serialVersionUID = 1L;
>> >
>> >     private String hi ="";
>> >     private int count;
>> >
>> >     public HomePage(final PageParameters parameters) {
>> >
>> >         // WARNING HERE and next line
>> >         add(new Label<HomePage>("message", "If you see this message
>> wicket
>> >  is properly configured and running"));
>> >         add(new FeedbackPanel("feedback"));
>> >         Form<HomePage> form = new Form<HomePage>("form", new
>> >  CompoundPropertyModel<HomePage>(this)) {
>> >             private static final long serialVersionUID = 1L;
>> >             @Override public void onSubmit() {
>> >                 ++count;
>> >             }
>> >         };
>> >         add(form);    // WARNING HERE
>> >         form.add(new TextField<HomePage>("hi").setRequired(true));
>> >         // WARNING HERE
>> >         add(new Label<HomePage>("hihi", new
>> PropertyModel<HomePage>(this,
>> >  "hello")));
>> >     }
>> >
>> >     public String getHello() {
>> >         return hi + ": you say hello " + count + " times.";
>> >     }
>> >  }
>> >
>>
>>
>>
>> --
>> Resizable and reorderable grid components.
>> http://www.inmethod.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Migrating-to-1.4-SNAPSHOT%3A-how-to-rid-of-generic-warnings--tp16622159p16622850.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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

Reply via email to