Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 268659 - [publisher] Make VersionedName usable as a key
Summary: [publisher] Make VersionedName usable as a key
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.5 M7   Edit
Assignee: P2 Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-15 04:11 EDT by Thomas Hallgren CLA
Modified: 2009-04-13 17:29 EDT (History)
2 users (show)

See Also:


Attachments
Patch adding equals() and hashCode() methods (1.61 KB, patch)
2009-03-15 04:13 EDT, Thomas Hallgren CLA
no flags Details | Diff
Updated patch where both constructors replace null with emptyVersion (1.81 KB, patch)
2009-04-04 03:19 EDT, Thomas Hallgren CLA
john.arthorne: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Hallgren CLA 2009-03-15 04:11:09 EDT
Let the VersionedName implement the equals() and hashCode() methods so that it can be used as a key in a map.
Comment 1 Thomas Hallgren CLA 2009-03-15 04:13:30 EDT
Created attachment 128836 [details]
Patch adding equals() and hashCode() methods
Comment 2 Thomas Hallgren CLA 2009-03-15 04:17:39 EDT
I'm curious as to why the constructor:

 VersionedName(String id, String version)

will convert a null version argument into the emptyVersion when the constructor:

 VersionedName(String id, Version version)

makes no such attempt. Wouldn't it be more consistent to store either null or emptyVersion in both cases?
Comment 3 Jeff McAffer CLA 2009-04-03 09:49:26 EDT
I can't see any reason in particular.  can you add that change to the patch?
Comment 4 Thomas Hallgren CLA 2009-04-04 03:19:43 EDT
Created attachment 130909 [details]
Updated patch where both constructors replace null with emptyVersion
Comment 5 John Arthorne CLA 2009-04-13 17:28:51 EDT
Patch released to HEAD.