> From: Stephan Herrmann <stephan.herrm...@berlin.de>

> I've observed, that JDT has problems working with class file
> plus source attachment of org.osgi.framework.Bundle et al.
> Reason: when compiling the attached sources we can't find
> the annotation type org.osgi.annotation.versioning.ProviderType.
> I see that Equinox has the corresponding jar in its git repo,
> but the deployed org.eclipse.osgi doesn't seem to contain any
> hint on where this type could be found.

So you issue is that the org.eclipse.osgi jar file does not contain the 
annotation classes?

If you are compiling the OSGi sources in the  org.eclipse.osgi repo, you 
can get the annotations jar from the git repo too. I don't believe any of 
the Equinox source uses the OSGi versioning annotations.

> 
> Now, if the annotation had retention SOURCE, one might argue
> that after compilation the annotation no longer exists
> (which would still create a challenge for the compiler to
> find that the annotation we don't find is missing for a good
> reason - for detecting the SOURCE retention we would need to
> find the annotation in the first place).
> 
> With a CLASS retention, however, this annotation should IMHO
> be considered part of the API and without a dependency this
> makes it a secret clause as part of the public API, mhhh...

No. CLASS retention is not part of the runtime API since such annotations 
are not visible at runtime. They are visible at tool time such as when bnd 
packages bundles and uses information from the versioning annotations. 
Therefore the tools need access to the annotation types (which they will 
make sure they have). You also need access to compile the classes and the 
source repo provides the annotations in jar form.

> 
> Am I misreading something? Any suggestions how the compiler
> can cope with this fatal error on a published artifact?

I am not entirely clear on what you are doing here. Perhaps you can 
explain in more detail.

> 
> Who is supposed to use the information about this annotation?

Tools like bnd. They advise tools about the package version and whether 
types in the package are provider or consumer role. See the OSGi Semantic 
Versioning paper for more information on these roles. 
http://www.osgi.org/wiki/uploads/Links/SemanticVersioning.pdf

> How does that instance get access to the annotation definition?

The tool must of course have knowledge of the semantic meaning of the 
annotations. Since the tool is not loading the classes (and they are CLASS 
retention), the tools processes the class file'  bytecodes.
> 
> FYI, the problem occurs when JDT/UI functionality requests
> the resolved types of methods in the given interface.

-- 

BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the OSGi Alliance
hargr...@us.ibm.com

office: +1 386 848 1781
mobile: +1 386 848 3788
_______________________________________________
equinox-dev mailing list
equinox-dev@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/equinox-dev

Reply via email to