Bug 137434 - [DataBinding] IdentityWrapper violates requirements for equals
Summary: [DataBinding] IdentityWrapper violates requirements for equals
Status: RESOLVED DUPLICATE of bug 137435
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-19 02:12 EDT by Daniel Krügler CLA
Modified: 2006-04-19 02:14 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Krügler CLA 2006-04-19 02:12:20 EDT
The current implementation of IdentityWrapper violates the basic requirements for equals (see http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#equals(java.lang.Object)),
namely

"For any non-null reference value x, x.equals(null) should return false"

because it can't handle null values. The current implementation:

 public boolean equals(Object obj) {
  if (obj.getClass() != IdentityWrapper.class) {
   return false;
  }
  return o == ((IdentityWrapper) obj).o;  }

should be changed to:

 public boolean equals(Object obj) {
  if (obj == null || obj.getClass() != IdentityWrapper.class) {
   return false;
  }
  return o == ((IdentityWrapper) obj).o;  }

to fix this issue. (Note: I'm aware that IdentityWrapper is an internal
class, but it looks like a class which might be made public in the
future, so I mentioned this point)
Comment 1 Daniel Krügler CLA 2006-04-19 02:14:42 EDT

*** This bug has been marked as a duplicate of 137435 ***