You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Pierre De Rop (JIRA)" <ji...@apache.org> on 2016/10/17 21:59:58 UTC

[jira] [Comment Edited] (FELIX-5346) Start annotation not propagated to sub classes

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

Pierre De Rop edited comment on FELIX-5346 at 10/17/16 9:59 PM:
----------------------------------------------------------------

Unless there is a bug, it should also work with all other annotations, which can now be declared on inherited classes.

See the "Base" class in the integration test here:

http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/InheritedAnnotations.java?revision=1761367&view=co

The only restriction is that when you define a @ServiceDependency on the mother class, then you can add more @ServiceDependency annotations in child class only on some other different services.

for example:

{code}
class Base {
    @ServiceDependency
    volatile Service1 m_s1;
}

class Child extends Base {
    @ServiceDependency
    volatile Service2 m_s2;
}
{code}

but, currently, overriding the same @ServiceDependency on the same service (but with a different filter for example) is not possible:

{code}
class Base {
    @ServiceDependency
    volatile Service1 m_s1;
}

class Child extends Base {
    // not currently supported: we can't override the same dependency inherited from the Base class ...
    @ServiceDependency(filter="(foo=bar)")
    volatile Service1 m_s1;
}
{code}










was (Author: pderop):
Unless there is a bug, it should also work with all other annotations, which can now be declared on inherited classes.

See the "Base" class in the integration test here:

http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager.runtime.itest/src/org/apache/felix/dm/runtime/itest/components/InheritedAnnotations.java?revision=1761367&view=co






> Start annotation not propagated to sub classes
> ----------------------------------------------
>
>                 Key: FELIX-5346
>                 URL: https://issues.apache.org/jira/browse/FELIX-5346
>             Project: Felix
>          Issue Type: Improvement
>          Components: Dependency Manager Annotations
>    Affects Versions: org.apache.felix.dependencymanager-r1
>            Reporter: Jago de Vreede
>            Assignee: Pierre De Rop
>             Fix For: org.apache.felix.dependencymanager-r9
>
>
> Following case in pseudocode:
> {code}Class A {
>   @Start
>   public void start() {
>     System.out.println("start");
>   }
> }
> @Component
> Class B extends A {
> }{code}
> When you run this nothing is printed but the start method in A should be called as B extends A.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)