| Summary: | TaskRepository breaks the hashcode/equels contract! | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | elhanan Maayan <elh.mailgate> |
| Component: | Mylyn | Assignee: | Mylyn Inbox <mylyn-inbox> |
| Status: | RESOLVED WORKSFORME | QA Contact: | |
| Severity: | major | ||
| Priority: | P3 | ||
| Version: | 3.4 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
elhanan Maayan
I believe the implementation is correct. Please take a look at the contract for hashCode(). Basically if equals returns true for two Objects, the value returned by hashCode() must also be the same. The implementation in TaskRepository meets that contract. If two objects have the same hashCode() it is not guaranteed however that they are equal. In the case of TaskRepository it is implemented this way since the repository URL is mutable. Not hashing over the URL allows storing of TaskRepository objects in hash tables without having to worry about modifications to the objects. |