You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "Jean-Philippe CLEMENT (JIRA)" <ji...@apache.org> on 2016/03/03 17:16:18 UTC

[jira] [Comment Edited] (ARIES-1500) Conversion fails with generics

    [ https://issues.apache.org/jira/browse/ARIES-1500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15178024#comment-15178024 ] 

Jean-Philippe CLEMENT edited comment on ARIES-1500 at 3/3/16 4:16 PM:
----------------------------------------------------------------------

Even if you create a factory method which returns the proper generic type to be injected in another bean, the injection may fail (the equivalent code in regular Java would of course compile and run). I experienced this issue several times. Maybe, can you share the spec about the generics in Blueprint, so it will be clearer what is expected?

Furthermore, in that case the Blueprint syntax would not be correct as it should provide a way to express the generic type, for instance:
<bean class="org.sample.MyBean<Integer>"/>

Could you tell more about the converters, how to make and "publish" them?


was (Author: jeanphi):
Even if you create a factory method which returns the proper generic type to be injected in another bean, the injection may fail (the equivalent code in regular Java would of course compile and run). I experienced this issue several times. Maybe, can you share the spec about the generics, so it will be clearer what is expected?

Furthermore, in that case the Blueprint syntax would not be correct as it should provide a way to express the generic type, for instance:
<bean class="org.sample.MyBean<Integer>"/>

Could you tell more about the converters, how to make and "publish" them?

> Conversion fails with generics
> ------------------------------
>
>                 Key: ARIES-1500
>                 URL: https://issues.apache.org/jira/browse/ARIES-1500
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>    Affects Versions: blueprint-core-1.5.0
>         Environment: All
>            Reporter: Jean-Philippe CLEMENT
>
> Let's take a bean with the method setSomething(Something<T>) called via blueprint with another bean implementing Something => exception saying that bean conversion is not possible. But, if I change the method signature without the generic type setSomething(Something), then it works as expected.
> Blueprint should not care for the generic type as Java is type erasure and do not exceed the spec.
> There is no nice work around. Have to change all APIs used via Blueprint and take note for all deviations. This is really heavy.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)