Bug 506561 - Move @Service annotation from e(fx)clipse to platform
Summary: Move @Service annotation from e(fx)clipse to platform
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Runtime (show other bugs)
Version: 4.6   Edit
Hardware: PC All
: P3 enhancement (vote)
Target Milestone: 4.7 M6   Edit
Assignee: Dirk Fauth CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
Depends on:
Blocks: 510292
  Show dependency tree
 
Reported: 2016-10-26 10:19 EDT by Dirk Fauth CLA
Modified: 2017-02-15 05:39 EST (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-10-26 10:19:19 EDT
I would like to suggest to move the @Service annotation from e(fx)clipse to the platform.

https://wiki.eclipse.org/Efxclipse/Runtime/Recipes#Injection_of_OSGi-Services

IMHO it is a very useful annotation to get OSGi services injected in a DS comparable way.
Comment 1 Dirk Fauth CLA 2016-10-26 10:20:08 EDT
@Tom
Could you please link to the sources in e(fx)clipse?
We should also discuss where to put the necessary implementation classes.
Comment 2 Dirk Fauth CLA 2017-01-20 03:43:03 EST
As per discussion in Bug 510292 I would like to discuss in this ticket where the @Service annotation should be put to. I see two options:

- org.eclipse.e4.core.di.annotations

The implementation will then be in org.eclipse.e4.core.di.

- org.eclipse.e4.core.di.extensions

The implementation will then be in org.eclipse.e4.core.di.extensions.supplier (if Bug 463613 is fixed with the patch I provided).


I'm unsure where to put it actually. There are good arguments for and against any of these options. 

core.di.annotations because @Service would be a good candidate for a core annotation as working with services is (or IMHO should be) a common practice.

core.di.extensions because @Service is resolved by using an ExtendedObjectSupplier. So injection with @Service only works in combination with @Inject. Therefore it is an extension and not a core annotation like @CanExecute or @Execute.

Any thoughts?
Comment 3 Dani Megert CLA 2017-01-20 08:39:55 EST
I am only +1 if the annotation is actually used withing the Platform.
Comment 4 Dirk Fauth CLA 2017-01-20 09:05:58 EST
(In reply to Dani Megert from comment #3)
> I am only +1 if the annotation is actually used withing the Platform.

Hm, that would be a hard one as of now. AFAIK we don't have competing services in the platform and therefore no actual need for it on that level.

From my point of view that annotation increases the usability of OSGi DS in an Eclipse RCP application, as it provides functionality to retrieve multiple services of a type and with its newest addition even filters, which we don't support with the default injection mechanisms.

So it is intended to be used to connect the UI layer with the OSGi layer, by avoiding that users have to use low-level OSGi API to consume services.

In the end it could even help on getting rid of more Activators that are currently used to retrieve services.
Comment 5 Lars Vogel CLA 2017-01-31 04:47:45 EST
(In reply to Dani Megert from comment #3)
> I am only +1 if the annotation is actually used withing the Platform.

Having more control about the injection of OSGi services is a very common requirement in RCP applications. We usually use the "low-level" OSGi API for that in our RCP applications. +1 for adding this to the DI framework.
Comment 6 Eclipse Genie CLA 2017-02-08 17:13:34 EST
New Gerrit change created: https://git.eclipse.org/r/90682
Comment 8 Dirk Fauth CLA 2017-02-15 05:39:04 EST
Fixed with applied patch