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

 
 

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

Submitter:  Jonathan Olson <jpolson>
Submitted:  Tue 06 Mar 2007 04:36:52 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

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 Files:
   
   
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
  • -email is unavailable- added by jpolson (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-03-06 jpolson Attached File- Added test.m, #12129

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code