Return-Path: X-Original-To: apmail-tapestry-dev-archive@www.apache.org Delivered-To: apmail-tapestry-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EBF34187B9 for ; Fri, 24 Jul 2015 14:35:04 +0000 (UTC) Received: (qmail 58648 invoked by uid 500); 24 Jul 2015 14:35:04 -0000 Delivered-To: apmail-tapestry-dev-archive@tapestry.apache.org Received: (qmail 58598 invoked by uid 500); 24 Jul 2015 14:35:04 -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 58588 invoked by uid 99); 24 Jul 2015 14:35:04 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Jul 2015 14:35:04 +0000 Date: Fri, 24 Jul 2015 14:35:04 +0000 (UTC) From: "Jochen Kemnade (JIRA)" To: commits@tapestry.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (TAP5-2263) IOC decorator matching bug 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-2263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14640512#comment-14640512 ] Jochen Kemnade commented on TAP5-2263: -------------------------------------- I don't think that the fix you propose is correct. What's the exact error message you get? I guess, you should be more specific with your annotation. What about changing it to {{@Decorate(serviceInterface=CacheFactory.class)}}? > IOC decorator matching bug > -------------------------- > > Key: TAP5-2263 > URL: https://issues.apache.org/jira/browse/TAP5-2263 > Project: Tapestry 5 > Issue Type: Bug > Components: tapestry-ioc > Affects Versions: 5.4 > Reporter: Adriaan Joubert > Assignee: Jochen Kemnade > Labels: easyfix > > In our implementation we have a factory service CacheFactory, with markers, that is injected into a Cache service with the same markers (say @MarkerA). In tests, I wish to replace the CacheFactory with > @Decorate > @MarkerA > public CacheFactory decorate(...) {} > However I get an error that the decorate method returns the wrong type. > The cause is that the matching of the decorators in the module implementation does not match on ServiceDef and markers. Specifically in > ModuleImpl.findMatchingDecoratorDefs there is a condition > if (def.matches(serviceDef) || markerMatched(serviceDef, InternalUtils.toDecoratorDef2(def))) > result.add(def); > which needs to be > if (def.matches(serviceDef) && markerMatched(serviceDef, InternalUtils.toDecoratorDef2(def))) > result.add(def); > to fix the problem. With the || it matches unrelated service definitions with the same markers. > Thanks! -- This message was sent by Atlassian JIRA (v6.3.4#6332)