@Version as discouraged access

35 views
Skip to first unread message

Kamesh Sampath

unread,
Mar 16, 2015, 8:05:39 AM3/16/15
to bndtool...@googlegroups.com
I just now updated my bndtools to 3.0.0-DEV, and when I tried to generate the API package i see that in 

package-info.java


@Version("1.0.0")
package com.example.api

is being shown with a Eclipse Warning marker the "@Version" is a discouraged access from osgi.annotation-6.0.0.jar 

Why this sudden change from 2.5.x to 3.0.0, semantically i understand that version 2.5.x to 3.0.0 will have some incompatibility but then will be great if someone can explain :)

-Kamesh

Neil Bartlett

unread,
Mar 16, 2015, 8:19:03 AM3/16/15
to bndtool...@googlegroups.com
In bnd(tools) 3.0, we validate whether the packages you are using from each bundle on the build path are exported. For packages that are not exported we create the “discouraged access” marker.

Unfortunately there are some packages that are only ever intended to be used at build time and so don’t need to be exported. The versioning annotation package in osgi.annotation-6.0.0.jar is an example.

You can make the warnings go away by depending on the library as follows:

-buildpath: osgi.annotation; version=6.0; packages=*

However I don’t think this is acceptable and hope we can come up with a better solution before 3.0 is released.

Regards,
Neil

--
You received this message because you are subscribed to the Google Groups "bndtools-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kamesh Sampath

unread,
Mar 16, 2015, 8:29:58 AM3/16/15
to bndtool...@googlegroups.com
Thanks for the explanation Neil, do you want me to open a ticket in Github to track this or there is a existing ticket for the same.

This context is bit different but then I thought to bring it in here because of the "Context Markers",  when we have the Semantic Version violations also shown as "Error markers" but it would be great if we can provide a error marker with a solution to fix the problem, like bumping the version numbers on the package-info or package-info.java ?

Kamesh Sampath

unread,
Mar 16, 2015, 8:37:26 AM3/16/15
to bndtool...@googlegroups.com
Attaching a screenshot to provide more context on what I mean.
Screenshot 2015-03-16 18.05.33.png

BJ Hargrave

unread,
Mar 16, 2015, 8:46:17 AM3/16/15
to bndtool...@googlegroups.com
On Mar 16, 2015, at 08:17 , Neil Bartlett <njbar...@gmail.com> wrote:

In bnd(tools) 3.0, we validate whether the packages you are using from each bundle on the build path are exported. For packages that are not exported we create the “discouraged access” marker.

Unfortunately there are some packages that are only ever intended to be used at build time and so don’t need to be exported. The versioning annotation package in osgi.annotation-6.0.0.jar is an example.

You can make the warnings go away by depending on the library as follows:

-buildpath: osgi.annotation; version=6.0; packages=*

However I don’t think this is acceptable and hope we can come up with a better solution before 3.0 is released.

The issue is with the osgi.annotations jar. I have fixed it in the OSGi build but should probably plan on making a 6.0.1 release to get the fix to the public. bndtools 3.0 is correct.


Regards,
Neil

On 16 Mar 2015, at 12:05, Kamesh Sampath <kamesh....@liferay.com> wrote:

I just now updated my bndtools to 3.0.0-DEV, and when I tried to generate the API package i see that in 

package-info.java


@Version("1.0.0")
package com.example.api

is being shown with a Eclipse Warning marker the "@Version" is a discouraged access from osgi.annotation-6.0.0.jar 

Why this sudden change from 2.5.x to 3.0.0, semantically i understand that version 2.5.x to 3.0.0 will have some incompatibility but then will be great if someone can explain :)

-Kamesh

--
You received this message because you are subscribed to the Google Groups "bndtools-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "bndtools-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 

BJ



Peter Kriens

unread,
Mar 16, 2015, 8:48:40 AM3/16/15
to bndtool...@googlegroups.com
I think annotations need to be exported as well, they are clearly not private to the bundle?

Kind regards,

Peter Kriens

BJ Hargrave

unread,
Mar 16, 2015, 8:49:40 AM3/16/15
to bndtool...@googlegroups.com
On Mar 16, 2015, at 08:48 , Peter Kriens <peter....@aqute.biz> wrote:

I think annotations need to be exported as well, they are clearly not private to the bundle?

Yes. This is the fix I have made in the OSGi build. I should release it as 6.0.1 for the public to use.
-- 

BJ



Neil Bartlett

unread,
Mar 16, 2015, 11:28:03 AM3/16/15
to bndtool...@googlegroups.com
Thanks BJ. Yes I suppose you are right. I haven't checked what we do with non-bundle jars on the build path but I think they shouldn't show the discouraged-access warning.

Neil

--
Neil Bartlett
Sent from a phone

BJ Hargrave

unread,
Mar 16, 2015, 11:33:14 AM3/16/15
to bndtool...@googlegroups.com
On Mar 16, 2015, at 11:27 , Neil Bartlett <njbar...@gmail.com> wrote:

Thanks BJ. Yes I suppose you are right. I haven't checked what we do with non-bundle jars on the build path but I think they shouldn't show the discouraged-access warning.

If the jar is not a bundle (no manifest or no Bundle-ManifestVersion header), then there are no access restrictions. Otherwise the Export-Package header (which is considered empty if not present) is used to set the access restrictions. 

BJ Hargrave

unread,
Mar 16, 2015, 5:29:38 PM3/16/15
to bndtool...@googlegroups.com
On Mar 16, 2015, at 08:49 , BJ Hargrave <b...@bjhargrave.com> wrote:


On Mar 16, 2015, at 08:48 , Peter Kriens <peter....@aqute.biz> wrote:

I think annotations need to be exported as well, they are clearly not private to the bundle?

Yes. This is the fix I have made in the OSGi build. I should release it as 6.0.1 for the public to use.

I just pushed osgi.annotations-6.0.1 to maven central and jcenter.
-- 

BJ



Reply all
Reply to author
Forward
0 new messages