I thought about this a bit now. This is a bit of a mixed bag. Another pov is:
ArrayList<T> which gets erased to ArrayList<Object> should be treated as ArrayList. Now for the question: does a Producer for ArrayList also get used for an InjectionPoint of ArrayList<String>? In CDI 1.0 only the other way around was specified. We had this discussion with the Weld guys and also had this code in some CDI Extensions. Not an easy topic indeed. LieGrue, strub ----- Original Message ----- From: Arne Limburg <[email protected]> To: "[email protected]" <[email protected]> Cc: Sent: Saturday, 6 July 2013, 10:18 Subject: Re: OWB and generics Forgot to mention that T is an unbound type variable at class level: public class MethodTypeProduces1<T> and there is no subclass of MethodTypeProduces1 Am 06.07.13 10:12 schrieb "Romain Manni-Bucau" unter <[email protected]>: >Wait, not sure google ate a part of the code or not but if a <T> then T >can >be String (like ArrayList itself) >Le 6 juil. 2013 09:18, "Arne Limburg" <[email protected]> a >écrit : > >> Hi, >> >> I am currently struggling with the handling of generics in OWB, because >> CDI 1.1 TCK requires us to be much more clever than we are now in this >>area. >> However I stumbled about a test in our test-suite that seems to be wrong >> to me, but I would like to have another opinion. >> With my local implementation of the generic handling (which is much >>better >> than the one in trunk) the following tests fails: >> MethodProducer1Test.testPersonProducer >> >> Basically it tests if an ArrayList with an unbound type variable is >> injectable into an injection point of type ArrayList<String>: >> >> @Produces @Dependent @Named("ProMethodParameterized3") >> >> ArrayList<T> methodPT3() {...} >> >> and >> >> @Inject ArrayList<String> pt3; >> >> Reading 5.2.4 of the CDI 1.1 spec (the fourth bullet point) I would >> suggest that this should lead to an error since String is not assignable >> from Object (which is the upper bound of T). >> >> >> WDYT? >> >> >> Cheers, >> >> Arne >>
