On Wed, 02 Oct 2013 11:49:54 -0300, Alessio Gambi <alessioga...@gmail.com> wrote:

From the documentation (see http://tapestry.apache.org/service-advisors.html), it seems to be legal to combine the Advice and Match annotations:

@Advise(serviceInterface=MyService.class)
@Match("*DAO")
public static void byMatchAnnotation(MethodAdviceReceiver receiver)

This looks to me like a bad copy and paste from the previous example which forgot to delete the @Match annotation.

I'd vote for misuse. :P
Than the documentation should be updated.

Yep. And the code fixed to either make it work or to throw an exception when both annotations are used in the same method.

        public static ServiceUpdater buildOSServiceUpdater
        public static ServiceUpdater buildAmazonServiceUpdater
        public ServiceUpdaterCache buildServiceUpdaterCache

Where the interface ServiceUpdaterCache extends ServiceUpdater.

Therefore I should have 3 different services whose service-ids are:

        OSServiceUpdater
        AmazonServiceUpdater
        ServiceUpdaterCache

Thus by declaring the following annotations

1) @Advise(serviceInterface = ServiceUpdater.class)
2) @Advise(id = "ServiceUpdater", serviceInterface = ServiceUpdater.class) 3) @Advise(id = "OSServiceUpdater", serviceInterface = ServiceUpdater.class)

I expect the following outcomes:

1) That all three services (at least the 2 that are actually invoked at runtime) get the same advice
2) No service get the advice, as no one has matching service id
3) Only the OSServiceUpdater gets the advice.


But what I actually get is:

1) Ok: both OSServiceUpdater and ServiceUpdaterCache get the advice
2) NOT OK: both OSServiceUpdater and ServiceUpdaterCache get the advice, while none should 3) NOT OK: both OSServiceUpdater and ServiceUpdaterCache get the advice, while only OSServiceUpdater should

It seems that the code handling @Advise is ignoring id when serviceInterface is set. I think Tapestry-IoC shouldn't let both attributes (id and serviceInterface) to be used at the same time. It doesn't make sense.

Could you please file a JIRA? And thank you very much for reporting and investigating this issue. ;) That's a very good way of contributing to the project. :)

--
Thiago H. de Paula Figueiredo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to