You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Alex Rass <ar...@itbsllc.com> on 2010/06/15 12:05:20 UTC

is this a bug in Model?

Hi.

Was writing some code and encountered that 
org.apache.wicket.model.Model <T>

Always uses direct references to 'object' variable directly. And never as
getObject().
This may hinder overriding methods.

(I found this cause I overwrote getObject() and NOTHING changed :)  
I then looked at the source and knew how to fix it)

Bug or feature?

This is Wicket 1.4.7

- Alex 


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


Re: is this a bug in Model?

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
I concur.

**
Martin

2010/6/15 Alex Rass <ar...@itbsllc.com>:
> No, Martin, it can't work.
> Look at the implementation.
>
> ALL other methods use object directly.
> SO if you just override getObject you'll endup with a broken:
> equals(), hashCode(), toString() methods (which breaks any form of caching)
> detach() would also be broken.
>
> So no, it can't work.
> You HAVE to super.setObject() or setObject() directly and use internal
> object to use Model<T> class.
> Which is not deadly, but a "need to know".
>
> Hence: is it a bug or a feature?
> Igor? :)
>
> - Alex
>
>
> -----Original Message-----
> From: Martin Makundi [mailto:martin.makundi@koodaripalvelut.com]
> Sent: Tuesday, June 15, 2010 6:11 AM
> To: users@wicket.apache.org
> Subject: Re: is this a bug in Model<T>?
>
> I did something similar and it works.
>
> **
> Martin
>
> 2010/6/15 Alex Rass <ar...@itbsllc.com>:
>> Hi.
>>
>> Was writing some code and encountered that
>> org.apache.wicket.model.Model <T>
>>
>> Always uses direct references to 'object' variable directly. And never
>> as getObject().
>> This may hinder overriding methods.
>>
>> (I found this cause I overwrote getObject() and NOTHING changed :) I
>> then looked at the source and knew how to fix it)
>>
>> Bug or feature?
>>
>> This is Wicket 1.4.7
>>
>> - Alex
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: is this a bug in Model?

Posted by avrahamr <av...@gmail.com>.
Another option would be to directly implement IModel<T>.

On Tue, Jun 15, 2010 at 7:04 PM, Rodolfo Hansen [via Apache Wicket] <
ml-node+2256139-803998731-293983@n4.nabble.com<ml...@n4.nabble.com>
> wrote:

> Are you sure you want to override Model in the first place?
> Di you see LoadableDetachableModel ?
>
> Model is not ment to be an abstract class,
> I would argue its not a bug, but that would be a whole other debate...
>
> On Tue, 2010-06-15 at 06:56 -0400, Alex Rass wrote:
>
> > No, Martin, it can't work.
> > Look at the implementation.
> >
> > ALL other methods use object directly.
> > SO if you just override getObject you'll endup with a broken:
> > equals(), hashCode(), toString() methods (which breaks any form of
> caching)
> > detach() would also be broken.
> >
> > So no, it can't work.
> > You HAVE to super.setObject() or setObject() directly and use internal
> > object to use Model<T> class.
> > Which is not deadly, but a "need to know".
> >
> > Hence: is it a bug or a feature?
> > Igor? :)
> >
> > - Alex
> >
> >
> > -----Original Message-----
> > From: Martin Makundi [mailto:[hidden email]<http://user/SendEmail.jtp?type=node&node=2256139&i=0>]
>
> > Sent: Tuesday, June 15, 2010 6:11 AM
> > To: [hidden email]<http://user/SendEmail.jtp?type=node&node=2256139&i=1>
> > Subject: Re: is this a bug in Model<T>?
> >
> > I did something similar and it works.
> >
> > **
> > Martin
> >
> > 2010/6/15 Alex Rass <[hidden email]<http://user/SendEmail.jtp?type=node&node=2256139&i=2>>:
>
> > > Hi.
> > >
> > > Was writing some code and encountered that
> > > org.apache.wicket.model.Model <T>
> > >
> > > Always uses direct references to 'object' variable directly. And never
> > > as getObject().
> > > This may hinder overriding methods.
> > >
> > > (I found this cause I overwrote getObject() and NOTHING changed :) I
> > > then looked at the source and knew how to fix it)
> > >
> > > Bug or feature?
> > >
> > > This is Wicket 1.4.7
> > >
> > > - Alex
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=2256139&i=3>
> > > For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=2256139&i=4>
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=2256139&i=5>
> > For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=2256139&i=6>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=2256139&i=7>
> > For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=2256139&i=8>
> >
>
>
>
>
> ------------------------------
>  View message @
> http://apache-wicket.1842946.n4.nabble.com/is-this-a-bug-in-Model-T-tp2255650p2256139.html
> To start a new topic under Wicket - User, email
> ml-node+1842947-1647783149-293983@n4.nabble.com<ml...@n4.nabble.com>
> To unsubscribe from Wicket - User, click here<http://apache-wicket.1842946.n4.nabble.com/subscriptions/Unsubscribe.jtp?code=YXZyYWhhbXJAZ21haWwuY29tfDE4NDI5NDd8LTEwNzY0NzQ1ODc=>.
>
>
>


-- 
[]'s
Avraham Rosenzweig
avrahamr@gmail.com

-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/is-this-a-bug-in-Model-T-tp2255650p2256282.html
Sent from the Wicket - User mailing list archive at Nabble.com.

Re: is this a bug in Model?

Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
> it is a bug, open a jira issue

Or a feature? Either it should use getObject() internally or Model.getObject() should be declared final to prevent the programmer from thinking he can override it - both will solve the issue.

- Tor Iver

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


Re: is this a bug in Model?

Posted by Igor Vaynberg <ig...@gmail.com>.
it is a bug, open a jira issue

-igor

On Tue, Jun 15, 2010 at 9:03 AM, Rodolfo Hansen <kr...@gmail.com> wrote:
> Are you sure you want to override Model in the first place?
> Di you see LoadableDetachableModel ?
>
> Model is not ment to be an abstract class,
> I would argue its not a bug, but that would be a whole other debate...
>
> On Tue, 2010-06-15 at 06:56 -0400, Alex Rass wrote:
>
>> No, Martin, it can't work.
>> Look at the implementation.
>>
>> ALL other methods use object directly.
>> SO if you just override getObject you'll endup with a broken:
>> equals(), hashCode(), toString() methods (which breaks any form of caching)
>> detach() would also be broken.
>>
>> So no, it can't work.
>> You HAVE to super.setObject() or setObject() directly and use internal
>> object to use Model<T> class.
>> Which is not deadly, but a "need to know".
>>
>> Hence: is it a bug or a feature?
>> Igor? :)
>>
>> - Alex
>>
>>
>> -----Original Message-----
>> From: Martin Makundi [mailto:martin.makundi@koodaripalvelut.com]
>> Sent: Tuesday, June 15, 2010 6:11 AM
>> To: users@wicket.apache.org
>> Subject: Re: is this a bug in Model<T>?
>>
>> I did something similar and it works.
>>
>> **
>> Martin
>>
>> 2010/6/15 Alex Rass <ar...@itbsllc.com>:
>> > Hi.
>> >
>> > Was writing some code and encountered that
>> > org.apache.wicket.model.Model <T>
>> >
>> > Always uses direct references to 'object' variable directly. And never
>> > as getObject().
>> > This may hinder overriding methods.
>> >
>> > (I found this cause I overwrote getObject() and NOTHING changed :) I
>> > then looked at the source and knew how to fix it)
>> >
>> > Bug or feature?
>> >
>> > This is Wicket 1.4.7
>> >
>> > - Alex
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > For additional commands, e-mail: users-help@wicket.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
>

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


RE: is this a bug in Model?

Posted by Rodolfo Hansen <kr...@gmail.com>.
Are you sure you want to override Model in the first place?
Di you see LoadableDetachableModel ?

Model is not ment to be an abstract class, 
I would argue its not a bug, but that would be a whole other debate...

On Tue, 2010-06-15 at 06:56 -0400, Alex Rass wrote:

> No, Martin, it can't work.
> Look at the implementation.
> 
> ALL other methods use object directly.
> SO if you just override getObject you'll endup with a broken:
> equals(), hashCode(), toString() methods (which breaks any form of caching)
> detach() would also be broken.
> 
> So no, it can't work.
> You HAVE to super.setObject() or setObject() directly and use internal
> object to use Model<T> class.
> Which is not deadly, but a "need to know".
> 
> Hence: is it a bug or a feature?
> Igor? :)
> 
> - Alex 
> 
> 
> -----Original Message-----
> From: Martin Makundi [mailto:martin.makundi@koodaripalvelut.com] 
> Sent: Tuesday, June 15, 2010 6:11 AM
> To: users@wicket.apache.org
> Subject: Re: is this a bug in Model<T>?
> 
> I did something similar and it works.
> 
> **
> Martin
> 
> 2010/6/15 Alex Rass <ar...@itbsllc.com>:
> > Hi.
> >
> > Was writing some code and encountered that 
> > org.apache.wicket.model.Model <T>
> >
> > Always uses direct references to 'object' variable directly. And never 
> > as getObject().
> > This may hinder overriding methods.
> >
> > (I found this cause I overwrote getObject() and NOTHING changed :) I 
> > then looked at the source and knew how to fix it)
> >
> > Bug or feature?
> >
> > This is Wicket 1.4.7
> >
> > - Alex
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 



RE: is this a bug in Model?

Posted by Alex Rass <ar...@itbsllc.com>.
No, Martin, it can't work.
Look at the implementation.

ALL other methods use object directly.
SO if you just override getObject you'll endup with a broken:
equals(), hashCode(), toString() methods (which breaks any form of caching)
detach() would also be broken.

So no, it can't work.
You HAVE to super.setObject() or setObject() directly and use internal
object to use Model<T> class.
Which is not deadly, but a "need to know".

Hence: is it a bug or a feature?
Igor? :)

- Alex 


-----Original Message-----
From: Martin Makundi [mailto:martin.makundi@koodaripalvelut.com] 
Sent: Tuesday, June 15, 2010 6:11 AM
To: users@wicket.apache.org
Subject: Re: is this a bug in Model<T>?

I did something similar and it works.

**
Martin

2010/6/15 Alex Rass <ar...@itbsllc.com>:
> Hi.
>
> Was writing some code and encountered that 
> org.apache.wicket.model.Model <T>
>
> Always uses direct references to 'object' variable directly. And never 
> as getObject().
> This may hinder overriding methods.
>
> (I found this cause I overwrote getObject() and NOTHING changed :) I 
> then looked at the source and knew how to fix it)
>
> Bug or feature?
>
> This is Wicket 1.4.7
>
> - Alex
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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



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


Re: is this a bug in Model?

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
I did something similar and it works.

**
Martin

2010/6/15 Alex Rass <ar...@itbsllc.com>:
> Hi.
>
> Was writing some code and encountered that
> org.apache.wicket.model.Model <T>
>
> Always uses direct references to 'object' variable directly. And never as
> getObject().
> This may hinder overriding methods.
>
> (I found this cause I overwrote getObject() and NOTHING changed :)
> I then looked at the source and knew how to fix it)
>
> Bug or feature?
>
> This is Wicket 1.4.7
>
> - Alex
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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