Of course these are only details, but I wanted to get clear. It seems that in this case I cannot use List interface although List interface has super-interface Collection. When List is replaced with Collection all is OK, no compiler warnings:
IModel<Collection<String>> allYearsModel = new PropertyModel<Collection<String>>(this, "allYears"); ListMultipleChoice<String> allYears = new ListMultipleChoice<String>("allYears", allYearsModel, new ArrayList<String>()); I haven't checked the source yet, but probably someone could comment on this - why so? Juris On 27 February 2010 11:47, Juris Maskalans <jmaskal...@gmail.com> wrote: > Thanks for your quick response. But I have already tried to add needed > type, e.g. <String> and got the error. > I suppose the case is not so simple. > > IModel<List<String>> allYearsModel = new PropertyModel<List<String>>(this, > "selectedYears"); > ListMultipleChoice<String> allYears = new > ListMultipleChoice<String>("allYears", allYearsModel, new > ArrayList<String>()); > > gives error: > > "The constructor ListMultipleChoice<String>(String, IModel<List<String>>, > ArrayList<String>) is undefined" > > Should it not be a valid constructor for: > ListMultipleChoice(java.lang.String id, IModel<java.util.Collection<T>> > object, java.util.List<T> choices) > > When I use constructor without IModel, all is OK: > ListMultipleChoice<String> allYears = new > ListMultipleChoice<String>("allYears", new ArrayList<String>()); > > > When I look at DropDownChoice it works with similar constructor, e.g., > IModel<String> allYearsModel = new PropertyModel<String>(this, > "selectedYears"); > DropDownChoice<String> placeDdc = new DropDownChoice<String>("place", > allYearsModel, new ArrayList<String>()); > > I can not figure out, why so. > > Juris > > > > On 27 February 2010 00:15, Igor Vaynberg <igor.vaynb...@gmail.com> wrote: > >> ListMultipleChoice<String> tmp = new ListMultipleChoice<String>(... >> >> -igor >> >> On Fri, Feb 26, 2010 at 2:07 PM, Juris Maskalans <jmaskal...@gmail.com> >> wrote: >> > Hi, >> > >> > I have a question regarding ListMultipleChoice. >> > How to overcome generic warning. >> > "ListMultipleChoice is a raw type. References to generic type >> > ListMultipleChoice<T> should be parameterized" >> > >> > Despite of this the code works fine: >> > ListMultipleChoice tmp = new ListMultipleChoice("tmp", new >> > PropertyModel<List<String>>( >> > this, "selectedYears"), new ArrayList<String>()); >> > >> > Thanks! >> > Juris >> > >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> >