Re: Wicket 6.5 CompoundPropertyModel constructor ambiguity

2013-01-28 Thread Martin Grigorov
I believe that this question has been asked recently and it got a response.

http://markmail.org/thread/rfcqarnvct3t2gh3


On Fri, Jan 25, 2013 at 11: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 CompoundPropertyModelReportWebModel(reportWebModel)

 *where*

 ReportWebModel extends BaseWebModelReport

 *and*

 BaseWebModelT 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.IModelT) 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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com http://jweekend.com/


Re: Wicket 6.5 CompoundPropertyModel constructor ambiguity

2013-01-28 Thread Eric Jablow
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 CompoundPropertyModelReportWebModel(reportWebModel)

 *where*

 ReportWebModel extends BaseWebModelReport

 *and*

 BaseWebModelT 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.IModelT) 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 CompoundPropertyModelReport.

Given

class ReportWebModel implementsIModelReport {...}

ReportWebModel reportWebModel = ...;
IModelReport cpm = new CompoundPropertyModelReport(reportWebModel);

should succeed, because it matches the CPM constructor:
public class CompoundPropertyModelT {
public CompoundPropertyModel(IModelT 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



Wicket 6.5 CompoundPropertyModel constructor ambiguity

2013-01-25 Thread Pieter Claassen
When I try to create the following model after migrating to wicket 6.5.0

new CompoundPropertyModelReportWebModel(reportWebModel)

*where*

ReportWebModel extends BaseWebModelReport

*and*

BaseWebModelT 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.IModelT) 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

-- 
- - - - - - - - - - - - - - - - - - - -
  Pieter Claassen
  Musmato B.V.
  e: pieter.claas...@musmato.com
  t: +31 877 848259
  w: http://musmato.com
- - - - - - - - - - - - - - - - - - - -


Re: Wicket 6.5 CompoundPropertyModel constructor ambiguity

2013-01-25 Thread Bas Gooren

Well, from the looks of it it's a bit odd that you write

new CompoundPropertyModelReportWebModel(reportWebModel)

instead of

new CompoundPropertyModelReport(reportWebModel)

since ReportWebModel extends BaseWebModelReport

The CPM constructor expects either a type literal or a model. In your 
case it is both, and you tell the CPM (through the generic type) that 
you will provide a type literal.


Does your CPM have to be of type ReportWebModel?

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 25-1-2013 12:02, schreef Pieter Claassen:

When I try to create the following model after migrating to wicket 6.5.0

new CompoundPropertyModelReportWebModel(reportWebModel)

*where*

ReportWebModel extends BaseWebModelReport

*and*

BaseWebModelT 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.IModelT) 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