On Fri, Jan 25, 2013 at 4:24 AM, Pieter Claassen
<pieter.claas...@gmail.com> wrote:
> When I try to create the following model after migrating to wicket 6.5.0
>
> new CompoundPropertyModel<ReportWebModel>(reportWebModel)
>
> *where*
>
> ReportWebModel extends BaseWebModel<Report>
>
> *and*
>
> BaseWebModel<T> implements IModel
>
> My IDE (Intellij) shows no problem with type checking the code but when I
> try to compile it I get:
>
> java: reference to CompoundPropertyModel is ambiguous, both constructor
> CompoundPropertyModel(org.apache.wicket.model.IModel<T>) in
> org.apache.wicket.model.CompoundPropertyModel and constructor
> CompoundPropertyModel(T) in org.apache.wicket.model.CompoundPropertyModel
> match
>
> The problem goes away when I remove the generics but then I also lose the
> type checking.
>
> Any suggestions?
>
> Thanks,
> Pieter

Why do you have a CompoundPropertyModel with a Model as its generic
type? I would
expect you to want a CompoundPropertyModel<Report>.

Given

class ReportWebModel implementsIModel<Report> {...}

ReportWebModel reportWebModel = ...;
IModel<Report> cpm = new CompoundPropertyModel<Report>(reportWebModel);

should succeed, because it matches the CPM constructor:
public class CompoundPropertyModel<T> {
public CompoundPropertyModel(IModel<T> model) {..}
}

Remember, Java Generics have to match exactly.

Respectfully,
Eric Jablow

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to