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

Bug 248557

Summary: [ds tooling] Validate against multiple <reference> elements with the same interface attribute, but no target value
Product: [Eclipse Project] PDE Reporter: Simon Archer <sja.eclipse>
Component: UIAssignee: PDE-UI-Inbox <pde-ui-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: caniszczyk, hargrave, s.boshev
Version: 3.5   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Simon Archer CLA 2008-09-25 09:04:08 EDT
Using Eclipse 3.5M2.

A warning should be marked against <reference> elements that have identical interface attribute values.  This is not illegal in DS, but it is often a mistake. For example

<reference
  name="foo"
  cardinality="1..1"
  policy="static"
  interface="java.lang.Runnable"/>

<reference
  name="bar"
  cardinality="0..1"
  policy="dynamic"
  interface="java.lang.Runnable"
  bind="bind"
  unbind="unbind"/>

This should always be considered a mistake, regardless of the value of the name, cardinality, policy, bind and unbind attributes.

The exception to his rule is when the target attribute is specified, since this is used to fine-tune the selection of a service. Ideally the tooling should be able to warn when there are multiple <reference> elements with the same interface and target attribute values, but to do this perfectly is probably too hard since it is not enough to simply compare the target attributes for equality.

But I think it would be worth checking for the simple and most common case where you have multiple <reference> elements with the same interface and same target values, since this will catch & Paste errors.

Subscribing BJ and Stoyan for comment.
Comment 1 BJ Hargrave CLA 2008-09-25 09:21:54 EDT
If this is made a warning, it should certainly be configurable.

This may make sense if I am combining code from different places in my bundle. One piece of code may use the 1st reference and the other code the 2nd reference. They pieces of code may be fairly unrelated but I chose to package them together in my bundle. In this case, the two references to the same interface name is perfectly valid.
Comment 2 Eclipse Genie CLA 2018-09-27 08:00:40 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 3 Lars Vogel CLA 2019-09-02 15:05:34 EDT
This bug has been marked as stalebug a while ago without any further interaction.

If this report is still relevant for the current release, please reopen and remove the stalebug whiteboard flag.
Comment 4 Lars Vogel CLA 2019-09-02 15:11:08 EDT
This bug was marked as stalebug a while ago. Marking as worksforme.

If this report is still relevant for the current release, please reopen and remove the stalebug whiteboard tag.