Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 254955

Summary: Collector should handle duplicates
Product: [Eclipse Project] Equinox Reporter: John Arthorne <john.arthorne>
Component: p2Assignee: John Arthorne <john.arthorne>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: agcattle, susan
Version: 3.5   
Target Milestone: 3.5 M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 252456    
Attachments:
Description Flags
Fix none

Description John Arthorne CLA 2008-11-11 16:42:24 EST
It would be useful if the Collector class handled duplicate items being added. Currently it just adds items to a list with no checking for duplicates. If we have some need for accepting duplicates, we could have a flag controlling this.
Comment 1 John Arthorne CLA 2008-11-11 16:43:27 EST
I will investigate if there is any impact here.
Comment 2 Susan McCourt CLA 2008-11-11 18:16:18 EST
Some of the UI collectors filter out duplicates as a side effect of performing other work, such as finding the latest version of an IU.  Bug #252456 discusses the need for the UI collectors to do this more generally, and I think it'd be great if Collector supported this.  I don't know of a case in the UI that relies on duplicates being there.
Comment 3 John Arthorne CLA 2008-11-12 10:38:28 EST
Great, I was going to ask you about this. From the core use of collectors, it looks like we typically do not check for duplicates, and I suspect this will either cause problems or result in us doing extra work if the same IU is present in multiple repositories. I'm leaning towards just making Collector handle duplicates without exposing an option to allow duplicates. 
Comment 4 Susan McCourt CLA 2008-11-12 12:43:20 EST
(In reply to comment #3)
>I'm leaning towards just making Collector
> handle duplicates without exposing an option to allow duplicates. 

That sounds like the right approach, we can always open a bug later if the assumptions weren't true. 
Comment 5 John Arthorne CLA 2008-11-12 14:20:29 EST
Created attachment 117694 [details]
Fix
Comment 6 John Arthorne CLA 2008-11-12 14:21:22 EST
Released.