You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "Oliver Lietz (JIRA)" <ji...@apache.org> on 2009/12/13 13:33:18 UTC

[jira] Created: (ARIES-82) BeanRecipe fails when using generics

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;
    }

}

[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.


[jira] Closed: (ARIES-82) BeanRecipe fails when using generics

Posted by "Valentin Mahrwald (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ARIES-82?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Valentin Mahrwald closed ARIES-82.
----------------------------------


> 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
>            Assignee: Valentin Mahrwald
>         Attachments: ARIES-82.patch, 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.


[jira] Resolved: (ARIES-82) BeanRecipe fails when using generics

Posted by "Valentin Mahrwald (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ARIES-82?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Valentin Mahrwald resolved ARIES-82.
------------------------------------

    Resolution: Fixed

> 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
>            Assignee: Valentin Mahrwald
>         Attachments: ARIES-82.patch, 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.


[jira] Commented: (ARIES-82) BeanRecipe fails when using generics

Posted by "Oliver Lietz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ARIES-82?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12790432#action_12790432 ] 

Oliver Lietz commented on ARIES-82:
-----------------------------------

package org.springframework.beans.factory;

public interface FactoryBean<T> {

	T getObject() throws Exception;

	Class<? extends T> getObjectType();

	boolean isSingleton();

}

It's "T getObject()" in Spring 3.0. So, is this intended behavior? It looks wrong to me.


> 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.


[jira] Commented: (ARIES-82) BeanRecipe fails when using generics

Posted by "Valentin Mahrwald (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Assigned: (ARIES-82) BeanRecipe fails when using generics

Posted by "Valentin Mahrwald (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ARIES-82?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Valentin Mahrwald reassigned ARIES-82:
--------------------------------------

    Assignee: Valentin Mahrwald

> 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
>            Assignee: Valentin Mahrwald
>         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.


[jira] Updated: (ARIES-82) BeanRecipe fails when using generics

Posted by "Oliver Lietz (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ARIES-82?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oliver Lietz updated ARIES-82:
------------------------------

    Description: 
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)
[...]


  was:
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;
    }

}

[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)
[...]



> 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.


[jira] Updated: (ARIES-82) BeanRecipe fails when using generics

Posted by "Jeremy Hughes (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ARIES-82?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeremy Hughes updated ARIES-82:
-------------------------------

    Fix Version/s: 0.1

> 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
>            Assignee: Valentin Mahrwald
>             Fix For: 0.1
>
>         Attachments: ARIES-82.patch, 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.


[jira] Commented: (ARIES-82) BeanRecipe fails when using generics

Posted by "Jeremy Hughes (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ARIES-82?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12790372#action_12790372 ] 

Jeremy Hughes commented on ARIES-82:
------------------------------------

I suspect this is because the FactoryBean interface defines an "Object getObject()" method and SpringFactoryBean implements a "Spring getObject()". It looks like Aries Blueprint is finding both the interface method and the impl method on SpringFactoryBean and treating them as different.

> 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.


[jira] Updated: (ARIES-82) BeanRecipe fails when using generics

Posted by "Oliver Lietz (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ARIES-82?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oliver Lietz updated ARIES-82:
------------------------------

    Attachment: ARIES-82.patch

Thanks, Valentin. Adding mth.isSynthetic() in findMatchingMethods fixed it.


> 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
>            Assignee: Valentin Mahrwald
>         Attachments: ARIES-82.patch, 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.


[jira] Updated: (ARIES-82) BeanRecipe fails when using generics

Posted by "Oliver Lietz (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ARIES-82?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oliver Lietz updated ARIES-82:
------------------------------

    Attachment: test.tar.gz

test case


> 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;
>     }
> }
> [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.