bugGNUSTEP System - Bugs: bug #19220, NSArray containsObject: and...

 
 

bug #19220: NSArray containsObject: and indexOfObject: do not invoke isEqual on array element

Submitted by:  Jonathan Olson <jpolson>
Submitted on:  Tue 06 Mar 2007 04:36:52 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 06 Mar 2007 04:36:52 PM UTC, original submission:

The NSArray class has a subtle incompatiblity with the Foundation class on Cocoa.
According to the Apple OSX documentation for containsObject:

Discussion
This method determines whether anObject is present in the receiver by sending an isEqual: message to each of the receiver’s objects (and passing anObject as the parameter to each isEqual: message).

However, the GNUstep implementation instead invokes the isEqual: method on the parameter, passing the array element as the parameter to isEqual:. This causes subtle incompatibilities in applications which implement non-commutative isEqual: methods.

Attached is a test program illustrating this behavior. On OSX, this program returns YES for both containsObject: comparisons.

Jonathan Olson <jpolson>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #12129:  test.m added by jpolson (827B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jpolson (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 06 Mar 2007 04:36:52 PM UTCjpolsonAttached File-=>Added test.m, #12129

    Back to the top


    Powered by Savane 3.1-cleanup