Carsten Ziegeler wrote:
Stuart McCulloch wrote:

imho SCR should be using the classloader of the class that declared the
bind/unbind method, ie:

   method.getDeclaringClass().getClassLoader()

when loading parameter classes - always using B's classloader doesn't sound
right to me

Yes, I agree - now, the current implementation uses the classname of the service (string) to load the parameter class and then this class to find the corresponding method.

We could change this to iterate over all available methods and pick the one with the correct parameter (by string comparision) or - and this seems easier to me - use directly the class of the service. The bind/unbind methods are searched with a valid ServiceReference. This reference can be used directly to get the service itself and the service class.

WDYT?

It probably makes sense to change this in some fashion. We have the same issue inside the framework when we are trying to figure out how if a class is visible to a given bundle (in Util.loadClassUsingClass()). So, it makes sense that SCR might have to do something similar.

-> richard



Thanks
Carsten

Reply via email to