Michael Barker wrote:
 >>From the equals() code, its applicable in this case:

    // The toString output must match.
    if (! toString().equals(((KerberosPrincipal)that).toString()))
      return false;

In your message you did phrase things in terms of general contracts.

More to the point: Using toString in the implementation of equals
seems like a bad idea.  The only rationale I can think of is as a
hack to try to catch that the actual classes match.  But it seems
an unreliable and inefficient method to do so.

I'd go further: Implementing equals in terms of toString is a bug.
One should be able to change toString before better output or
debuggability without breaking equals.
--
        --Per Bothner
[EMAIL PROTECTED]   http://per.bothner.com/


_______________________________________________
Classpath mailing list
Classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath

Reply via email to