correct me if I'm wrong here, I have a new job and can't get the code, but
you (Alex) say..

The implementation [of URLName.equals()] in the Sun JavaMail breaks this by
not being
transitive (that is, it is possible for the equals method to have
a.equals(c) and b.equals(c), but not a.equals(b). The implementation I
used had the advantage that (a) it was transitive, and that (b) the
implementation of the method is more efficient for large numbers of
subclasses.

The only time a behavioural difference will be noted is if subclasses
of the offending object (URLName) are created.


Surely in this instance the easiest way to obtain the correct behaviour is
to delegate the equality to String.equals() and compare the internal STring
represanetaion of the called object with the toString() of the argument?
After all URLName is conceptually a nice example of a specialisation of
String, but owing to String's final nature it can't actually be a String,
on the other hand we can obtain the relevant effects of inheritance through
delegation.

d.



***************************************************************************
The information in this e-mail is confidential and for use by the addressee(s) 
only. If you are not the intended recipient (or responsible for delivery of the 
message to the intended recipient) please notify us immediately on 0141 306 
2050 and delete the message from your computer. You may not copy or forward it 
or use or disclose its contents to any other person. As Internet communications 
are capable of data corruption Student Loans Company Limited does not accept 
any  responsibility for changes made to this message after it was sent. For 
this reason it may be inappropriate to rely on advice or opinions contained in 
an e-mail without obtaining written confirmation of it. Neither Student Loans 
Company Limited or the sender accepts any liability or responsibility for 
viruses as it is your responsibility to scan attachments (if any). Opinions and 
views expressed in this e-mail are those of the sender and may not reflect the 
opinions and views of The Student Loans Company Limited.

This footnote also confirms that this email message has been swept for the 
presence of computer viruses.

**************************************************************************

Reply via email to