Hi Arnaud: thanks for your replay
> -----Original Message----- > From: Arnaud Blandin [mailto:[EMAIL PROTECTED] > Sent: Tuesday, 24 June 2003 5:50 PM > To: [EMAIL PROTECTED] > Subject: Re: [castor-dev] Generated equals() method faulty? > > > Hi Dean, > > We apologize for not replying right away. As a contributor to the > project I try to spend a little time each week handling issue and > answering questions. Sometimes you will catch us when our > attention is > devoted to Castor, other times you may catch us when our attention is > devoted to our regular jobs. There are no full-time or paid employees > working on Castor and there are going to be times when the main > contributors are not available to answer your questions. It > doesn't mean > we don't care, it just means we happen to be busy at the > moment. All we > can promise is that we will continue to try to do our best > when we can > spare some cycles. Sorry for the inconvenience. No apology required - there was no inconvenience. I do not expect anyone of this list to jump off their perch the minute that I post - especially as a Castor newbie. I posted and waited. Fortunately, the stuff I'm working on allowed time to wait, but I need to make some progress on it soon, so I figured I should just dig in and do it myself. This is all cool - it's my problem after all, not yours. Anybody who has the time/enthusiasm to contribute to any open-source project has my admiration. > > Concerning your problem, can you please send us the XML schema that > demonstrates the problem? My xsd is attached. With org.exolab.castor.builder.equalsmethod=true, it generates the incorrect the equals(). With regards to my BTW: problem, I can't reproduce it. I'm sure I saw it before. (sigh) > I agree with you that the equals() > method seem > broken and the following should be generated: > if (this._has_x != temp._has_x) > return false; > if (this._has_x && this._x != temp._x) > return false; > > Feel free to send me your patch and I will review it, Happy to: attached as a zip. I added a field to JField so I could tell the real fields from those added by Castor (the "_has") fields, rather than try to guess from the name. > > Arnaud > Regards and thanks Dean > -----Original Message----- > From: Chalker, Dean [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 24, 2003 2:37 AM > To: [EMAIL PROTECTED] > Subject: Re: [castor-dev] Generated equals() method faulty? > > Hi all, > � > I've been unsuccessful in eliciting any comments to my postings of 18 > June.� That's cool.� Judging from the other postings, > perhaps I am the > only one working with this part of Castor. > � > I'm happy enouigh to go off into my own corner and make > things work the > way that I thing is reasonable.� Is there any committer out there you > would be interested in my changes? > � > � > regards > Dean > � > � > -----Original Message----- > From: Chalker, Dean [mailto:[EMAIL PROTECTED] > Sent: Wednesday, 18 June 2003 2:09 PM > To: [EMAIL PROTECTED] > Subject: [castor-dev] Generated equals() method faulty? > Hi again, > � > Apologies for posting again - I'm going to post this then > shutup until > you guys get a change to reply. > � > I'm using castor 0.9.5, with > org.exolab.castor.builder.javaclassmapping=type > � > Seems to me that the code generated by SourceGenerator for > the equals() > method is incorrect for primitive types.� For each primitive > field, it > generates code like .... > � > ���������� if (this._x != temp._x) > ��������������� return false; > ����������� if (this._has_x != temp._has_x) > ��������������� return false; > � > I'd suggest that if the fields _has_x are both false, then > the value of > the _x field is immaterial.� I've had a look at > SourceFactor.createEqualsMethod(), where there is comment > about handling > nulls for non-primitives.� Seems to me that the same is true for the > primitive fields through the _has flags. > � > Correct code could possibly be: > � > ����������� if (this._has_x != temp._has_x) > ��������������� return false; > ���������� if (this._has_x && this._x != temp._x) > ��������������� return false; > This is easy enough to do, provided I can tell the difference between > the _has field and real boolean fields.� Looking�at JField, > seems I can > only do this by the name, which seems a bit dodgy. > � > � > BTW: with > org.exolab.castor.builder.javaclassmapping=element, I get an > equals method that looks like: > � > ��� public boolean equals(java.lang.Object obj) > ��� { > ������� if ( this == obj ) > ����������� return true; > ������� > ������� if (super.equals(obj)==false) > ����������� return false; > ������� > ������� if (obj instanceof Point) { > ������� > ����������� Point temp = (Point)obj; > ����������� return true; > ������� } > ������� return false; > ��� } //-- boolean equals(java.lang.Object) > � > This seems basically broken too, as there is no reference made�to the > temp variable!!!! > � > � > Regards and thanks > Dean > � > � > intelli WHERE www.intelliwhere.com > > Dr. Dean Chalker� > Senior Architect > [EMAIL PROTECTED] > > IntelliWhere Division, �Intergraph Corporation > Australia > > Phone: 61-7-3510 8918� Fax: 61-7-3510 8901� > � > � > � > > ----------------------------------------------------------- > If you wish to unsubscribe from this mailing, send mail to > [EMAIL PROTECTED] with a subject of: > unsubscribe castor-dev >
deans-problem.xsd
Description: Binary data
deans-problem-patch.zip
Description: Binary data
