aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guillaume Nodet (JIRA)" <>
Subject [jira] [Commented] (ARIES-1500) Conversion fails with generics
Date Wed, 02 Mar 2016 17:33:18 GMT


Guillaume Nodet commented on ARIES-1500:

I disagree that Java does not care about that.
If you have a setter with List<String> and you inject a List<Integer>, you will
certainly run into ClassCastException.
The checks that blueprint does are done to avoid such exceptions at runtime.

The blueprint spec mandates this behaviour, so we can't really change the default anyway.
 One way around the problem is to provide a converter.  You can implement a Something =>
Something<T> conversion if you want.

Also, if you inject a bean implementing Something<Foo> and your setter is setSomething(Something<Foo>),
the exception should not occur.

> Conversion fails with generics
> ------------------------------
>                 Key: ARIES-1500
>                 URL:
>             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

View raw message