Hello,

I'm upgrading an application that embedded Felix 3.2.2 to Felix 4.4.1 and
am trying to use generics as intended.  Generally, things are working out
well, however, it doesn't seem straightforward to use the ServiceFactory<S>
interface with:

BundleContext.registerService(Class<S> clazz, S service,
Dictionary<String,?> properties)

If "service" is a ServiceFactory instance, then "clazz" isn't compatible
with "service" (in terms of generics).  If I specify the
MyServiceFactory.class (where MyServiceFactory implements
ServiceFactory<MyType>) then javac expects a service registration with a
type of ServiceFactory, and not of the service's type, which is not what I
would have expected compared with the "String" variant.

How is this supposed to be used?  Is the ServiceRegistration supposed to be
of type MyServiceFactory or of the interface of MyType ?

Thanks,
Christopher

Reply via email to