Community
Participate
Working Groups
3.2M6: 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)
*** Bug 137434 has been marked as a duplicate of this bug. ***
Daniel, can you attach a patch? If not I can take care of it, not a big deal. Also if null is passed the current code will throw a NPE.
Created attachment 39007 [details] Proposed fix for equals "Can't handle" was just a nicer description for the NPE ;-)
This was already fixed, I added the contribution comment and removed a duplicate of this class.