[ 
https://issues.apache.org/jira/browse/FELIX-2486?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12892779#action_12892779
 ] 

Felix Meschberger commented on FELIX-2486:
------------------------------------------

A concrete situation from the Sling project:

   Bundle B1 has:

       /**
        * @scr.component metatype="no" abstract="yes"
        * @scr.service interface="javax.servlet.Servlet"
        */
       public abstract class AbstractComponent extends HttpServlet {}

   Bundle B2 has:

       /**
        * @scr.component metatype="no"
        */
       public class Component extends AbstractComponent {}

While building the SCR descriptors for B2 the AbstractComponent fails to 
validate the exported interface.

> ClassLoaderJavaClassDescription.isA does not work under certain circumstances
> -----------------------------------------------------------------------------
>
>                 Key: FELIX-2486
>                 URL: https://issues.apache.org/jira/browse/FELIX-2486
>             Project: Felix
>          Issue Type: Bug
>          Components: Maven SCR Plugin
>    Affects Versions:  maven-scr-plugin-1.4.4
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For:  maven-scr-plugin-1.4.6
>
>
> Consider two bundles B1 and B2. B1 provides an abstract component AC1. This 
> abstract component declares itself to implement Service S by means of
>    @scr.service interface="S"
> No AC1 does not itself implement S but it extends a baseclass which in turn 
> implements S.
> This bundle B1 builds perfectly and the SCR plugin generates the descriptor 
> for the abstract component.
> Now, B2 provides a concrete component CC2 extending AC1. B2 fails to build 
> while trying to generate the SCR descriptor.
> The reason for this is, that while generating descriptor for CC2, the exsting 
> service descriptor for AC1 is validated, particularly the service element. 
> This element is checked in the context of the abstract AC1 component class 
> internally represented by a ClassLoaderJavaClassDescriptor instance. To 
> verify the interface, the isA(String) method is called.
> This is where the problem occurrs: The ClassLoaderJavaClassDescriptor.isA 
> method only considers the interfaces directly implemented by the class but 
> not any interfaces implemented by the parent class. Moreover, this 
> implementation does not allow for classes (as opposed to interfaces) to be 
> used as service interface name.
> The fix is probably to use Class.isAssignableFrom to implement the isA method.

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

Reply via email to