Hi,

I'm sure this has already been discussed, but I was working with some
stuff that was using annotations, when it hit me that it's rather
inconvenient to publish an OSGi service based on an annotation. You'd
have to publish it using java.lang.Object, and come up with some (not
standardized) property to contain the FQ-name of the annotation.
There's also no 'type-safety' involved which checks to see if the
class of the returned service-object does indeed carry the required
annotation.

Considering that it's not possible to 'implement' an annotation (which
would produce clashes), would it be a viable addition to the spec to
allow service objects to be registered (extrapolate as needed to
service factories) using an FQ-name of an annotation as
'interface'-name, where the framework is responsible for checking that
said service object does indeed carry the annotation? This is of
course assuming that annotations are supported in the runtime
environment, but it does not impose such an assumption on any
interfaces, and so the spec is still valid in pre-annotation
environments. As far as I can tell, annotations are used primarily
(only?) in combination with reflection, so there's no real reason to
provide an actual type-check.

I can see that there might be concerns in the general direction of
proxy objects, but then again, I believe those have a problem in
general with respect to annotations?

Greetings,
Fredrik.
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to