Return-Path: X-Original-To: apmail-tapestry-commits-archive@minotaur.apache.org Delivered-To: apmail-tapestry-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 93CEF6EB9 for ; Mon, 30 May 2011 05:31:33 +0000 (UTC) Received: (qmail 83446 invoked by uid 500); 30 May 2011 05:31:32 -0000 Delivered-To: apmail-tapestry-commits-archive@tapestry.apache.org Received: (qmail 83251 invoked by uid 500); 30 May 2011 05:31:31 -0000 Mailing-List: contact commits-help@tapestry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tapestry.apache.org Delivered-To: mailing list commits@tapestry.apache.org Received: (qmail 83239 invoked by uid 99); 30 May 2011 05:31:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 May 2011 05:31:29 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 May 2011 05:31:27 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id B37F5E877C for ; Mon, 30 May 2011 05:30:47 +0000 (UTC) Date: Mon, 30 May 2011 05:30:47 +0000 (UTC) From: "Igor Drobiazko (JIRA)" To: commits@tapestry.apache.org Message-ID: <961748264.52745.1306733447731.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1296454668.68642.1303258566639.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Assigned] (TAP5-1510) The @Advise annotation limits advice to just a specific interface type MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/TAP5-1510?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Igor Drobiazko reassigned TAP5-1510: ------------------------------------ Assignee: Igor Drobiazko > The @Advise annotation limits advice to just a specific interface type > ---------------------------------------------------------------------- > > Key: TAP5-1510 > URL: https://issues.apache.org/jira/browse/TAP5-1510 > Project: Tapestry 5 > Issue Type: Bug > Components: tapestry-ioc > Affects Versions: 5.3.0, 5.2.5 > Reporter: Howard M. Lewis Ship > Assignee: Igor Drobiazko > > @Advise requires that you specify a service interface (there's no default value). This is much more limiting than the advise method naming prefix, which will match all services (subject to the use of @Match), without regard to service interface. > Further, inside ModuleImpl: > private boolean markerMatched(ServiceDef serviceDef, Markable markable) > { > if (!serviceDef.getServiceInterface().equals(markable.getServiceInterface())) > return false;; > here, the Markable is the AdvisorDef2 instance generated from the @Advise annotation. This is an exact comparison; I believe this should be: > if (! markable.getServiceInterface().isAssignableFrom(serviceDef.getServiceInterface())) return false; > That, combined with a default of Object.class for @Advisor.serviceInterface would do the trick ... the @Advise.serviceInterface acts as an umbrella over any services' service interface. > ..... ok, did more research and more stepping with the debugger. The above should be fixed, but it's only the second case of matching, the primary match should be based on the @Match annotation ... but that's broken too: > Frrom DefaultModuleDefImpl: > private String[] extractPatterns(T annotation, String id, Method method) > { > if(annotation != null) > return new String[]{}; > > Match match = method.getAnnotation(Match.class); > if (match == null) > return new String[] > { id }; > return match.value(); > } > Here, the annotation is the @Advise annotation; I don't get why it returns empty string array; we should still see if there's a @Match annotation. Looking at the code, I can't see any reason why we would return that empty string array, the presense of the @Advise annotation (or for a decorator method, the @Decorate annotation) has no purpose I can figure out. > In my situation, my advise method was not invoked because > a) Primary check (by service id) failed, because the @Match annotation was ignored > b) Secondary check (by service type and marker annotations) failed, because of inexact match on service interface > So, the end result is the @Advise is only useful to advise a specific service interface, which is the opposite of what method advice is about ... it's supposed to match against a swath of services, adapting the advise to whatever methods are present in those services. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira