You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Felix Meschberger (JIRA)" <ji...@apache.org> on 2010/08/05 10:42:15 UTC

[jira] Created: (FELIX-2520) Bind method selection must not expect the component's bundle to import the service interface type

Bind method selection must not expect the component's bundle to import the service interface type
-------------------------------------------------------------------------------------------------

                 Key: FELIX-2520
                 URL: https://issues.apache.org/jira/browse/FELIX-2520
             Project: Felix
          Issue Type: Bug
          Components: Declarative Services (SCR), Specification compliance
    Affects Versions:  scr-1.4.0
            Reporter: Felix Meschberger
            Assignee: Felix Meschberger
             Fix For:  scr-1.4.2


Our Declarative Services implementation tries to load the type of the bound service through the class loader of the component. This has the side-effect of expecting the component's bundle to actually import (and wire to) the package providing the interface.

On the other hand the Declarative Services specification states, that a bind/unbind method is acceptable if "the type of the argument is assignable from the type specified by the reference's interface attribute" (OSGi Compendium R4.2, Section 112.3.1, Accessing Services). This does not imply that the component must know the service type but a supertype of the service type.

For example the CT contains a test where the component's bind method expects an Object type parameter (which is certainly assignable from any type) but the component's bundle does not import the actual interface type. Thus with the current implementation the CT test fails.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (FELIX-2520) Bind method selection must not expect the component's bundle to import the service interface type

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-2520?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger closed FELIX-2520.
------------------------------------


Apache Felix Declarative Services 1.6.0 has been released. The issues are now closed.

> Bind method selection must not expect the component's bundle to import the service interface type
> -------------------------------------------------------------------------------------------------
>
>                 Key: FELIX-2520
>                 URL: https://issues.apache.org/jira/browse/FELIX-2520
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR), Specification compliance
>    Affects Versions:  scr-1.4.0
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For:  scr-1.6.0
>
>
> Our Declarative Services implementation tries to load the type of the bound service through the class loader of the component. This has the side-effect of expecting the component's bundle to actually import (and wire to) the package providing the interface.
> On the other hand the Declarative Services specification states, that a bind/unbind method is acceptable if "the type of the argument is assignable from the type specified by the reference's interface attribute" (OSGi Compendium R4.2, Section 112.3.1, Accessing Services). This does not imply that the component must know the service type but a supertype of the service type.
> For example the CT contains a test where the component's bind method expects an Object type parameter (which is certainly assignable from any type) but the component's bundle does not import the actual interface type. Thus with the current implementation the CT test fails.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (FELIX-2520) Bind method selection must not expect the component's bundle to import the service interface type

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-2520?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger resolved FELIX-2520.
--------------------------------------

    Resolution: Fixed

Fixed in Rev. 982608. To find a matching bind/unbind method taking a service object, the reference type is now searched as follows:

   (1) try to load through the component class loader
   (2) try to find an exported package from PackageAdmin service
   (3) use Object class

The first check may fail if the component's bundle does not import the service interface. Such an import is not required by the specification and is not required because a matching method must have an argument to which the service reference type can be assigned. This may be a supertype of the actual type which may be known to the component's bundle.

The second check allows for supporting a super type of the reference type used by the component's bind/unbind method. This may fail if the reference type is not actually exported by the service bundle.

The third case works as a common fallback to components which don't care for the actual service type but want to know when a service is available or not.

> Bind method selection must not expect the component's bundle to import the service interface type
> -------------------------------------------------------------------------------------------------
>
>                 Key: FELIX-2520
>                 URL: https://issues.apache.org/jira/browse/FELIX-2520
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR), Specification compliance
>    Affects Versions:  scr-1.4.0
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For:  scr-1.4.2
>
>
> Our Declarative Services implementation tries to load the type of the bound service through the class loader of the component. This has the side-effect of expecting the component's bundle to actually import (and wire to) the package providing the interface.
> On the other hand the Declarative Services specification states, that a bind/unbind method is acceptable if "the type of the argument is assignable from the type specified by the reference's interface attribute" (OSGi Compendium R4.2, Section 112.3.1, Accessing Services). This does not imply that the component must know the service type but a supertype of the service type.
> For example the CT contains a test where the component's bind method expects an Object type parameter (which is certainly assignable from any type) but the component's bundle does not import the actual interface type. Thus with the current implementation the CT test fails.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.