Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 492726 - [DS] Change check for missing unbind methods only for dynamic references
Summary: [DS] Change check for missing unbind methods only for dynamic references
Status: VERIFIED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.6   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.7 M2   Edit
Assignee: Peter Nehrer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 490058
  Show dependency tree
 
Reported: 2016-04-29 08:56 EDT by Dirk Fauth CLA
Modified: 2016-09-09 04:12 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Fauth CLA 2016-04-29 08:56:40 EDT
Following the discussion in [1] the default error handling for dealing with missing unbind methods should be changed to ignore, as the unbind method is not mandatory.

[1] http://stackoverflow.com/questions/36932825/osgi-modify-event-method-not-called
Comment 1 Dirk Fauth CLA 2016-05-05 08:46:59 EDT
@Peter
What do you think about this? Did you have a specific reason for setting the default to Error?
Comment 2 Peter Nehrer CLA 2016-05-05 09:00:17 EDT
It's defaulted this way in order to preserve backward-compatibility behavior with releases previous to this fix. Keep in mind this plugin has been used in production for years before it came to PDE.

Since it's new to PDE we can default it to false, but in practice I find that this is by far the most common developer mistake (to mis-name the implicit unbind method accidentally).
Comment 3 Peter Nehrer CLA 2016-05-05 09:03:07 EDT
(In reply to Peter Nehrer from comment #2)
> It's defaulted this way in order to preserve backward-compatibility behavior
> with releases previous to this fix. 

By "this fix" I mean https://github.com/ecliptical/ds-annotations/issues/15.
Comment 4 Dirk Fauth CLA 2016-05-05 09:18:02 EDT
I understand ... a discussion about defaults is always not that easy. While on the one hand I'm completely with you that this could be one of the most common mistakes that is hard to find, it leads on the other hand to misunderstandings of the spec. For example, because of the error I thought that it is necessary to specify an unbind method to follow the specification. Now I know that it is not. So the error is somehow misleading.

Not sure, what do you think? Maybe make it a warning and modify the message a little bit?
Comment 5 Peter Nehrer CLA 2016-05-05 09:30:38 EDT
I'm fine with it defaulting to false in PDE. Warning would work as well.
Comment 6 Dirk Fauth CLA 2016-06-17 17:35:58 EDT
I have to correct myself. It seems I misinterpreted the comment in the linked discussion. Although it is not necessary it seems to be a common and best practice to specify an unbind method. At least for dynamic references. Even bndtools is showing an error in this case. 

I therefore tend to keep the error as default. But maybe it makes sense to restrict the warning only to dynamic references. 

What do you think? 

There was a discussion here https://groups.google.com/forum/m/#!topic/bndtools-users/tFJES5f3R0I
Comment 7 Peter Nehrer CLA 2016-06-20 09:08:35 EDT
So are you suggesting that we don't keep the preference and just flag missing unbind for dynamic references as error, OR, that we keep the preference but apply it to dynamic references only?
Comment 8 Dirk Fauth CLA 2016-06-20 09:42:58 EDT
(In reply to Peter Nehrer from comment #7)
> So are you suggesting that we don't keep the preference and just flag
> missing unbind for dynamic references as error, OR, that we keep the
> preference but apply it to dynamic references only?

I would keep the preference but only apply it to dynamic references. That would fit the bnd recommendations by still leaving the option to change the behavior.

For static references it seems to be really not necessary to provide an unbind method because of re-activation of a component configuration.
Comment 9 Eclipse Genie CLA 2016-08-14 10:45:34 EDT
New Gerrit change created: https://git.eclipse.org/r/79021
Comment 11 Vikas Chandra CLA 2016-09-06 06:10:55 EDT
Peter, if this is fixed via previous commit, can you please resolve this defect. Thanks !
Comment 12 Vikas Chandra CLA 2016-09-08 15:12:09 EDT
Dirk, can you please verify this fix. Thanks!
Comment 13 Dirk Fauth CLA 2016-09-09 04:12:04 EDT
Tested with I20160906-0800 and works as expected