[
https://issues.apache.org/jira/browse/ARIES-82?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12790622#action_12790622
]
Valentin Mahrwald commented on ARIES-82:
----------------------------------------
What seems to happen is that the Java compiler creates a synthetic bridge
method "Object getObject" that bridges between the getObject declared in
FactoryBean (Object getObject()) and the one implemented in SpringFactoryBean
(Spring getObject()).
Blueprint finds both these methods and throws it hands up, where it should
probably filter out synthetic / bridge methods, which would give a unique
result.
> BeanRecipe fails when using generics
> ------------------------------------
>
> Key: ARIES-82
> URL: https://issues.apache.org/jira/browse/ARIES-82
> Project: Aries
> Issue Type: Bug
> Components: Blueprint
> Reporter: Oliver Lietz
> Attachments: test.tar.gz
>
>
> public class SpringFactoryBean implements FactoryBean<Spring> {
> public Spring getObject() throws Exception {
> return new Primavera();
> }
> public Class<? extends Spring> getObjectType() {
> return Primavera.class;
> }
> public boolean isSingleton() {
> return false;
> }
> }
> <?xml version="1.0" encoding="UTF-8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
> <bean id="springFactory"
> class="com.example.testing.aries.blueprint.springfactorybean.SpringFactoryBean"/>
> <bean id="spring" factory-ref="springFactory" factory-method="getObject"/>
> <service ref="spring"
> interface="com.example.testing.aries.blueprint.springfactorybean.Spring"/>
> </blueprint>
> [pool-1-thread-1] ERROR
> org.apache.aries.blueprint.container.BlueprintContainerImpl - Unable to start
> blueprint container for bundle
> com.example.testing.aries.blueprint.springfactorybean
> org.osgi.service.blueprint.container.ComponentDefinitionException: Multiple
> matching factory methods getObject found on class
> com.example.testing.aries.blueprint.springfactorybean.SpringFactoryBean for
> arguments [] when instanciating bean spring: [public java.lang.Object
> com.example.testing.aries.blueprint.springfactorybean.SpringFactoryBean.getObject()
> throws java.lang.Exception, public
> com.example.testing.aries.blueprint.springfactorybean.Spring
> com.example.testing.aries.blueprint.springfactorybean.SpringFactoryBean.getObject()
> throws java.lang.Exception]
> at
> org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:231)
> at
> org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:645)
> at
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:64)
> at
> org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:212)
> at
> org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:140)
> at
> org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:604)
> at
> org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:311)
> at
> org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:211)
> [...]
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.