Hi,
In the OSGi compendium specification (Release 4, Version 4.3) on page 275 annotations are defined as an alternative for the DS XML files. I noticed that the package org.osgi.service.component.annotations which contains those annotations is exported in org.osgi.services (3.3.100) which comes with the latest Equinox SDK.

I was not able to use the annotations with Equinox. Also, there are not dependencies from equinox.ds to org.osgi.service.component.annotations. I think this indicates that it's simply not implemented, right?

Are there any plans to support this or is there a known workaround e.g. using Apache SCR?

Am 24.10.2012 11:34, schrieb Holger Staudacher:
> In the OSGi compendium specification (Release 4, Version 4.3) on
> page 275 annotations are defined as an alternative for the DS XML files. I
> noticed that the package org.osgi.service.component.annotations which
> contains those annotations is exported in org.osgi.services (3.3.100)
> which comes with the latest Equinox SDK.

AFAIK the annotations are not interpret at runtime. They are only useful
for at build time when the XML file is actually generated. DS still
relies on the XML file currently.

There is a contribution in Bugzilla to add such a build processing step
to PDE. But the activity on the bug is not very promising. Do you know
if there is a Tycho/Maven plug-in which can generate the XML?

AFAIK the annotations are not interpret at runtime. They are only useful
for at build time when the XML file is actually generated. DS still
relies on the XML file currently.

This is correct. These annotations have only class retention and are not runtime visible annotations. They are for tools to use (like bnd or PDE) to generate the xml when packaging the bundle. DS implementation cannot use the annotations at runtime; they must only use the xml.

Has it been discussed to allow those annotations at runtime and add a
"Service-ComponentClass" header to the manifest? DS could do byte code
scanning to scan those classes for annotations and generate the
component at runtime (without loading the class).

Has it been discussed to allow those annotations at runtime and add a
"Service-ComponentClass" header to the manifest? DS could do byte code
scanning to scan those classes for annotations and generate the
component at runtime (without loading the class).

Yes, the idea to support the annotations at runtime has been mentioned for a future spec. Such support would be necessary to allow "inheritance" of annotations so that, for example, @Reference could be used in a super class of the component implementation class.

No actual work has started on this though. The current proposals for the next DS spec update do not include this.