Regarding case 2, as far as I know the only place in the Java Common
Annotations spec that touches on the behavior of annotations with respect to
inheritance is chapter 2 on policy annotations.  It says that the rules of
JSR 250 apply.  According to JSR 250 annotations on hidden class members are
ignored.  So if we decided these rules also apply to @Reference, the
@Reference annotation would not be honored.  If your derived class did not
contain setYourService then the @Reference annotation would be honored.

I think this arose in the policy section because some of the security
annotations are similar to those in J2EE3 and the EE3 spec probably
references JSR 250.  Perhaps it should be raised as a spec issue whether the
statements made about this in chapter 2 should be broadened to apply to all
of the annotations.  I haven't tested this extensively but my impression is
that the current tuscany code base complies with at least some of these
rules.

BTW I think the example 2a in section 2.2.1 is wrong with respect to JSR 250
because it claims annotations from hidden members should be processed.

According to the javadoc java.lang.annotation.Inherited applies only to
classes so I don't think it applies in this case.

On 3/26/07, Scott Kurz <[EMAIL PROTECTED]> wrote:

Raymond,

I've wondered that before too.  Your case 2 would have been answered by
the
SCA spec if the @Reference annotation were defined to be, annotated itself
with:
java.lang.annotation.Inherited.    Since it's not annotated, I'm not sure
what to think from the SCA perspective, (though it's clear what the Java
lang perspective is).


On 3/23/07, Raymond Feng <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> If I have component implementation class like this:
>
> Case 1:
> public class MyServiceImpl implements MyService {
>     private YourService yourService;
>
>     public void setYourService(YourService yourService) {
>         this.yourService = yourService;
>     }
> }
>
> public interface MyService {
>     @Reference
>     void setYourService(YourService yourService);
> }
>
> Q1: Should "yourService" be treated as a reference?
>
> Case 2:
> public class MyServiceImpl extends MyServiceBaseImpl {
>     public void setYourService(YourService yourService) {
>         super.setYourService(yourService);
>         // Do addtional things here
>     }
> }
>
> public class MyServiceBaseImpl {
>     protected YourService yourService;
>
>     @Reference
>     public void setYourService(YourService yourService) {
>         this.yourService = yourService;
>     }
> }
>
> Q2: Should "yourService" be treated as a reference?
>
> Am I crazy?
>
> Thanks,
> Raymond
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to