Community
Participate
Working Groups
I created a new bundle for a declarative service and wanted to test the @Component annotation. With the old plugin from the marketplace I could write @Component and use code completion to add the import statement. No additional Import-Package is necessary there. With the Neon M6 version code completion doesn't work. I have to add org.osgi.service.component.annotations to the Imported-Packages first, before code completion works. I don't know what causes this difference in behavior, but as the annotations are only needed at compile time, I think we should not force a user to specify the import package statement, as it is not needed at runtime. The need for adding the import package statement even introduces another issue if users are not aware. While running on Equinox it would be ok to simply specify the import package, it is mandatory to set it to optional if it is intended to run the bundle also on another runtime. That means the Import-Package statement needs to look like this to work across multiple runtimes: org.osgi.service.component.annotations;version="1.2.0";resolution:=optional Instead the dependency should be added to the build.properties like this IMHO: extra.. = platform:/plugin/org.eclipse.osgi.services_xxx.jar or in a more version independent form. Maybe someone else has an idea on how to add a build time dependency from the Eclipse Platform without polluting the bundle dependencies.
I am playing around with declarative services annotations in Neon and find it really annoying to add the optional import statement all the time before I can start to use them in a newly created project. But as far as I understand, there is a bigger discussion ongoing regarding this. Just wanted to bump this up, as personally the annotations are a big improvement in Neon.
*** This bug has been marked as a duplicate of bug 488800 ***