[ 
https://issues.apache.org/jira/browse/ARIES-325?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Valentin Mahrwald resolved ARIES-325.
-------------------------------------

    Fix Version/s: 0.2
       Resolution: Fixed

Resolved in revision 951687.

> static factory methods with the same names are not distinguished during bean 
> instantiation
> ------------------------------------------------------------------------------------------
>
>                 Key: ARIES-325
>                 URL: https://issues.apache.org/jira/browse/ARIES-325
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>            Reporter: Richard Ellis
>            Assignee: Valentin Mahrwald
>            Priority: Minor
>             Fix For: 0.2
>
>
> I have a class SuperClass with a static method:
> public static SuperObject getObject(){...return SuperObject}
> this class is subclassed by SubClass which also has a static method:
> public static SubObject getObject(){...return SubObject}
> where SubObject extends SuperObject
> when I use <bean id="someFactoryBean" class="SubClass" 
> factory-method="getObject"/> I get a ComponentDefinitionException:
> ServiceRecipe E org.apache.aries.blueprint.container.ServiceRecipe 
> createService Error retrieving service from ServiceRecipe[name='.component-2']
>                                  
> org.osgi.service.blueprint.container.ComponentDefinitionException: Multiple 
> matching factory methods getObject found on class
>                                   my.package.SubClass for arguments [] when 
> instanciating bean someFactoryBean: [
>                                   public static 
> my.package.SubClass.getObject(), 
>                                   public static 
> my.package.SuperClass.getObject()]
>       at 
> org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:248)
>       at 
> org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:675)
>       at 
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:64)
>       at 
> org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:60)
>       at 
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:64)
>       at 
> org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:219)
>       at 
> org.apache.aries.blueprint.container.BlueprintRepository.createInstance(BlueprintRepository.java:198)
>       at 
> org.apache.aries.blueprint.container.BlueprintRepository.create(BlueprintRepository.java:137)
>       at 
> org.apache.aries.blueprint.container.ServiceRecipe.createRecipe(ServiceRecipe.java:350)
>       at 
> org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:256)
>       at 
> org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:228)
>       at 
> org.apache.aries.blueprint.container.ServiceRecipe.getService(ServiceRecipe.java:307)
>       at 
> org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(ServiceRecipe.java:365)
>       at 
> org.eclipse.osgi.internal.serviceregistry.ServiceUse$1.run(ServiceUse.java:120)
>       at 
> java.security.AccessController.doPrivileged(AccessController.java:202)
>       at 
> org.eclipse.osgi.internal.serviceregistry.ServiceUse.getService(ServiceUse.java:118)
>       at 
> org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:449)
>       at 
> org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.getService(ServiceRegistry.java:430)
>       at 
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.getService(BundleContextImpl.java:667)
>       at 
> org.apache.aries.blueprint.container.BlueprintContainerImpl.getService(BlueprintContainerImpl.java:400)
>       at 
> org.apache.aries.blueprint.container.ReferenceRecipe.getService(ReferenceRecipe.java:180)
>       at 
> org.apache.aries.blueprint.container.ReferenceRecipe.access$000(ReferenceRecipe.java:49)
>       at 
> org.apache.aries.blueprint.container.ReferenceRecipe$ServiceDispatcher.call(ReferenceRecipe.java:201)
>       at 
> org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe$CgLibProxyFactory$1.loadObject(AbstractServiceReferenceRecipe.java:634)
> I think the bean should be instantiated using the static method declared on 
> the class I specified as an attribute.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to