bndtools / bnd

Bnd/Bndtools. Tooling to build OSGi bundles including Eclipse, Maven, and Gradle plugins.
https://bndtools.org
Other
528 stars 306 forks source link

BND 3 is not capable of processing @Meta.OCD annotations #1130

Closed izaera closed 8 years ago

izaera commented 8 years ago

I'm getting the following exception when using BND3 (this used to work in 2.4.1):

java.lang.NullPointerException
    at java.lang.StringBuilder.<init>(StringBuilder.java:109)
    at aQute.bnd.osgi.Analyzer.validResourcePath(Analyzer.java:3261)
    at aQute.bnd.metatype.MetatypeAnnotations.analyzeJar(MetatypeAnnotations.java:101)
    at aQute.bnd.osgi.Analyzer.doPlugins(Analyzer.java:658)
    at aQute.bnd.osgi.Analyzer.analyze(Analyzer.java:213)
    at aQute.bnd.osgi.Builder.analyze(Builder.java:379)
    at aQute.bnd.osgi.Analyzer.calcManifest(Analyzer.java:688)
    at aQute.bnd.osgi.Builder.build(Builder.java:104)
    at aQute.bnd.osgi.Builder$build.call(Unknown Source)
    at org.dm.gradle.plugins.bundle.JarBuilder.build(JarBuilder.groovy:109)

If I switch from @Meta.OCD to @ObjectClassDefinition everything works fine.

djencks commented 8 years ago

What exactly did you do to get this NPE? For me just a @Metat.OCD didn't cause problems, I had to also use a @XMLAttribute-annotated annotation as well. See the pull request.

izaera commented 8 years ago

@djencks I think @rotty3000 was talking yesterday with some people from your team (I don't know if you were involved) and they came to the conclusion that XMLAttribute annotations don't work with BND metatype annotations which is what you are saying.

I forgot to mention that in the issue description :-(. Sorry.

djencks commented 8 years ago

The XMLAttribute meta-annotation definitely does not work with the BND metatype annotations and no one has any plans to add support, since you should use the spec annotations instead. The test I came up with that pre-fix produced an NPE involved using both an XMLAttributed annotation and the BND metatype annotations; since the fix eliminated the NPE I think the pull request fixes this issue.