aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niels Bertram (JIRA)" <>
Subject [jira] [Created] (ARIES-1282) BeanRecipe.findMatchingMethods is not able to filter out overridden method signatures
Date Sun, 04 Jan 2015 11:23:34 GMT
Niels Bertram created ARIES-1282:

             Summary: BeanRecipe.findMatchingMethods is not able to filter out overridden
method signatures
                 Key: ARIES-1282
             Project: Aries
          Issue Type: Bug
          Components: Blueprint
    Affects Versions: blueprint-core-1.1.0, blueprint-core-1.4.2
            Reporter: Niels Bertram

I was trying to get an Infinispan cache object from an infinispan CacheManager using the following
blueprint configuration:

<reference id="cacheManager" availability="mandatory" interface="org.infinispan.manager.CacheContainer"

<bean id="queueCountCache" factory-ref="cacheManager" factory-method="getCache">
	<argument index="0" type="java.lang.String" value="QueueCountCache" />

Unfortunately the blueprint startup fails with following error:

org.osgi.service.blueprint.container.ComponentDefinitionException: Multiple matching factory
methods getCache found on class Proxy36341b52_07db_4c05_bab0_40dbf8a3899a for arguments [QueueCountCache]
when instanciating bean queueCountCache: [public org.infinispan.commons.api.BasicCache Proxy36341b52_07db_4c05_bab0_40dbf8a3899a.getCache(java.lang.String),
public org.infinispan.Cache Proxy36341b52_07db_4c05_bab0_40dbf8a3899a.getCache(java.lang.String)]
        at org.apache.aries.blueprint.container.BeanRecipe.getInstance([7:org.apache.aries.blueprint.core:1.4.0]
        at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2([7:org.apache.aries.blueprint.core:1.4.0]
        at org.apache.aries.blueprint.container.BeanRecipe.internalCreate([7:org.apache.aries.blueprint.core:1.4.0]

looking at the matches produced by the {{BeanRecipe.findMatchingMethods}} makes it obvious
that the {{CacheContainer}} implements an interface {{BasicCacheContainer}}. The {{CacheContainer}}
interface overrides the getCache(java.lang.String) that is initially defined in the {{BasicCacheContainer}}
without any changes. I guess this was implemented for some backward compatibility.

The {{BeanRecipe.findMatchingMethods}} probably also needs to check if the method signatures
found are overridden by another method in the matching collection. If that is the case, all
methods that are overridden also need to be discharged.

Here are the 2 offending interfaces that the {{BeanReceipe}} matchtes:

package org.infinispan.manager;

import org.infinispan.Cache;
import org.infinispan.commons.api.BasicCache;
import org.infinispan.commons.api.BasicCacheContainer;

public interface CacheContainer extends BasicCacheContainer {

   <K, V> Cache<K, V> getCache();

   <K, V> Cache<K, V> getCache(String cacheName);


package org.infinispan.commons.api;

public interface BasicCacheContainer extends Lifecycle {
   <K, V> BasicCache<K, V> getCache();

   <K, V> BasicCache<K, V> getCache(String cacheName);

This message was sent by Atlassian JIRA

View raw message