This is the craziest thing I've seen in java (1.6):
Set<ActionPlan> actionPlans = assessment.getActionPlans();
The first two statements are passed on, but the last failed.
I do not give you details about the ActionPlan and Assessment classes, because it does not matter. The contains method does not work, where there are no equal and hash.
I am not saying that java is broken or something else, there is something funny in my code.
Please note that I am an experienced Java programmer, and I know about dos and not for implementing equals and hashCode. Therefore, if something is missing in my code, it is not something obvious.
Has anyone seen something mysterious?
EDIT
I did some research in my code, and now I think the problem is in sleep mode. I registered the hashCode of the ActionPlan object, after creation, and in different parts of the code until the calling failing call was called. He does not change .
I also checked the class returned by the .getActionPlans () evaluation method, and this:
org.hibernate.collection.internal.PersistentSet
I am tempted to believe that this implementation of Set does not use peers or hashcode correctly.
Does anyone know about this?