You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Thiago H. de Paula Figueiredo (JIRA)" <ji...@apache.org> on 2014/05/31 06:12:03 UTC
[jira] [Assigned] (TAP5-2263) IOC decorator matching bug
[ https://issues.apache.org/jira/browse/TAP5-2263?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thiago H. de Paula Figueiredo reassigned TAP5-2263:
---------------------------------------------------
Assignee: Thiago H. de Paula Figueiredo
> 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: Thiago H. de Paula Figueiredo
> 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.2#6252)