[
https://issues.apache.org/jira/browse/ARIES-672?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13045606#comment-13045606
]
Stephen Saucier commented on ARIES-672:
---------------------------------------
I should mention that this issue can be worked around by creating an
org.osgi.service.blueprint.container.Converter implementation which "converts"
ExtendsFoo to Foo<Bar>.
> Erroneous "no type converter available to convert from type" exception for
> parameterized types
> ----------------------------------------------------------------------------------------------
>
> Key: ARIES-672
> URL: https://issues.apache.org/jira/browse/ARIES-672
> Project: Aries
> Issue Type: Bug
> Components: Blueprint
> Affects Versions: 0.3
> Reporter: Stephen Saucier
>
> org.apache.aries.blueprint.container.AggregateConverter.convert(Object,
> ReifiedType) throws an Exception when the ReifiedType has type parameters.
> The issue is in the "isAssignable" function line 416 (of version 0.3) where
> there is a check that "target.size() == 0". This condition can never be true
> for parameterized types, so it is assumed that the object is not assignable.
> For example, consider the following
> public interface Foo<T> {
> ...
> }
> public interface Bar {
> ...
> }
> public class ExtendsFoo implements Foo<Bar> {
> ...
> }
> public class Baz {
> public void setFoo(Foo<Bar> foo);
> }
> wiring of an instance of ExtendsFoo to Baz fails with the exception message
> "no type converter available to convert from type: ExtendsFoo to the required
> type: Foo<Bar>"
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira