Bug 490061 - [DS] Auto-completion not working without Import-Package
Summary: [DS] Auto-completion not working without Import-Package
Status: CLOSED DUPLICATE of bug 488800
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: ---   Edit
Assignee: PDE-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks: 490058
  Show dependency tree
 
Reported: 2016-03-21 04:53 EDT by Dirk Fauth CLA
Modified: 2016-09-28 07:38 EDT (History)
1 user (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-03-21 04:53:02 EDT
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.
Comment 1 Dirk Fauth CLA 2016-04-28 11:07:31 EDT
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.
Comment 2 Lars Vogel CLA 2016-09-28 07:38:11 EDT

*** This bug has been marked as a duplicate of bug 488800 ***