You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "D. Stuart Freeman" <st...@et.gatech.edu> on 2010/04/20 16:34:23 UTC

difference in javadoc vs annotation references

I have an abstract class with a service reference in it and a getter
method for retreiving it.  If I use the javadoc method of declaring the
reference, classes that extend the abstract are able to call the getter
and use the service.  Switching to the annotation method of declaring the
reference results in the getter returning null.  Is this expected
behavior?  Is there a way to make it work using the annotations?

-- 
D. Stuart Freeman
Georgia Institute of Technology

Re: difference in javadoc vs annotation references

Posted by "D. Stuart Freeman" <st...@et.gatech.edu>.
I'd like to thank Carsten for helping me off list, and share the answer
in case someone is looking for it in the future.  The abstract class
needs to be annotated with '@Component(componentAbstract=true)'.

On Wed, Apr 21, 2010 at 08:30:44AM +0200, Carsten Ziegeler wrote:
> Ian Boston  wrote
> > I think you have to put the annotation on the *class* of the concrete class, since the annotation process does not look at parent classes. (possibly a retention issue).
> That would really be a retention.
> 
> Stuart, could you please send me a simple example demonstration this?
> 
> Carsten
> 
> > 
> > There was a similar problem but different problem with QDocs.
> > 
> > Ian
> > On 21 Apr 2010, at 00:34, D. Stuart Freeman wrote:
> > 
> >> I have an abstract class with a service reference in it and a getter
> >> method for retreiving it.  If I use the javadoc method of declaring the
> >> reference, classes that extend the abstract are able to call the getter
> >> and use the service.  Switching to the annotation method of declaring the
> >> reference results in the getter returning null.  Is this expected
> >> behavior?  Is there a way to make it work using the annotations?
> >>
> >> -- 
> >> D. Stuart Freeman
> >> Georgia Institute of Technology
> > 
> > 
> 
> 
> -- 
> Carsten Ziegeler
> cziegeler@apache.org

-- 
D. Stuart Freeman
Georgia Institute of Technology

Re: difference in javadoc vs annotation references

Posted by Carsten Ziegeler <cz...@apache.org>.
Ian Boston  wrote
> I think you have to put the annotation on the *class* of the concrete class, since the annotation process does not look at parent classes. (possibly a retention issue).
That would really be a retention.

Stuart, could you please send me a simple example demonstration this?

Carsten

> 
> There was a similar problem but different problem with QDocs.
> 
> Ian
> On 21 Apr 2010, at 00:34, D. Stuart Freeman wrote:
> 
>> I have an abstract class with a service reference in it and a getter
>> method for retreiving it.  If I use the javadoc method of declaring the
>> reference, classes that extend the abstract are able to call the getter
>> and use the service.  Switching to the annotation method of declaring the
>> reference results in the getter returning null.  Is this expected
>> behavior?  Is there a way to make it work using the annotations?
>>
>> -- 
>> D. Stuart Freeman
>> Georgia Institute of Technology
> 
> 


-- 
Carsten Ziegeler
cziegeler@apache.org

Re: difference in javadoc vs annotation references

Posted by Ian Boston <ie...@tfd.co.uk>.
I think you have to put the annotation on the *class* of the concrete class, since the annotation process does not look at parent classes. (possibly a retention issue).

There was a similar problem but different problem with QDocs.

Ian
On 21 Apr 2010, at 00:34, D. Stuart Freeman wrote:

> I have an abstract class with a service reference in it and a getter
> method for retreiving it.  If I use the javadoc method of declaring the
> reference, classes that extend the abstract are able to call the getter
> and use the service.  Switching to the annotation method of declaring the
> reference results in the getter returning null.  Is this expected
> behavior?  Is there a way to make it work using the annotations?
> 
> -- 
> D. Stuart Freeman
> Georgia Institute of Technology