Tracking down a surprising Import-Package

32 बार देखा गया
नहीं पढ़े गए पहले मैसेज पर जाएं

Benson Margulies

नहीं पढ़ी गई,
16 सित॰ 2016, 8:05:09 am16/9/16
ईमेल पाने वाला bndtool...@googlegroups.com
Using the bnd-maven-plugin, one of my bundles now has this Import-Package.

javax.annotation;version="[3.0.1,4)"

Until very recent changes, the version here was the relatively normal
'1.2'. Is there a way to get the plugin to tell me why it picked that
version range?

Benson Margulies

नहीं पढ़ी गई,
16 सित॰ 2016, 8:18:34 am16/9/16
ईमेल पाने वाला bndtool...@googlegroups.com
I've sort-of tracked this down, but I could use some advice.

I have a class that uses the 'findbugs' Nullable annotation, which
lives in (ugh) import javax.annotation.Nullable;

This is clearly awful, as it's in conflict with the real
javax.annotation package in the JRE.

In the working version of my code, somehow I ended up with the
harmless import of version 1.2 of this package, which corresponds to a
commonly available bundle. Some change I made has caused bnd to 'wake
up' and take the version out of the findbugs jar. I'll put something
into bnd.bnd to force the version I want. Has anyone else dealt with
findbugs pollution of this package?

David Jencks

नहीं पढ़ी गई,
17 सित॰ 2016, 1:38:02 pm17/9/16
ईमेल पाने वाला bndtool...@googlegroups.com
Maybe in the working case the findbugs bundle doesn’t export javax.annotation? Also, I didn’t think that annotations generally caused Import-Package? Am I misinformed or has that changed?

thanks
david jencks
> --
> 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 Hargrave

नहीं पढ़ी गई,
17 सित॰ 2016, 1:40:39 pm17/9/16
ईमेल पाने वाला bndtool...@googlegroups.com
If the annotation has CLASS or RUNTIME retention, then bnd will make sure the necessary import is in place. SOURCE retention annotations aren't visible at runtime and thus no import is necessary.
--
--
BJ

BJ Hargrave

नहीं पढ़ी गई,
17 सित॰ 2016, 1:41:36 pm17/9/16
ईमेल पाने वाला bndtool...@googlegroups.com
Actually only RUNTIME retention annotations need an import.
--
--
BJ

Benson Margulies

नहीं पढ़ी गई,
17 सित॰ 2016, 2:43:16 pm17/9/16
ईमेल पाने वाला bndtool...@googlegroups.com
It's definitely a runtime annotation. The exports in its bundle are here.

It looks to me as if JSR-305 versus things like PreDestroy is a
pain-point for OSGi. These various JSR's all want to make
contributions to javax.annotation, but no one publishes an artifact
that has the entire contents of the package.

Export-Package: edu.umd.cs.findbugs.annotations;uses:="javax.annotatio
n,javax.annotation.meta";version="3.0.1",javax.annotation;version="3.
0.1",net.jcip.annotations;version="3.0.1",javax.annotation.meta;versi
on="3.0.1",javax.annotation.concurrent;version="3.0.1"

BJ Hargrave

नहीं पढ़ी गई,
17 सित॰ 2016, 4:53:57 pm17/9/16
ईमेल पाने वाला bndtool...@googlegroups.com
What a ridiculous idea that anyone can contribute to a package. As you can see that is a big fail on OSGi and will also be a fail on Java 9 modules too.
--
--
BJ

David Jencks

नहीं पढ़ी गई,
17 सित॰ 2016, 5:38:58 pm17/9/16
ईमेल पाने वाला bndtool...@googlegroups.com
Well, a cautionary tale…. Bill Pugh proposed jsr 305 and, I suppose, assumed it would be completed and overenthusiastically started using the proposed annotations in released (? or usable or used) findbugs versions which have become quite popular…. then the jsr died in 2012.

david jencks

सभी प्रषकों को उत्तर दें
लेखक को उत्तर दें
आगे भेजें
0 नया मैसेज