The e-mail I responded to had a non-generic example with plain old java object which I specifically mentioned, and that is what I was referring to.
That said, I was incorrect. Object should be in the list of bean types for all objects. The reason that example isn't valid is that the injection point is specifically for a String and not for anything in String's hierarchy. I think the point Arne was trying to make is that you can't assign less specific things (Object) to more specific type (String) in the case of non-generics and was comparing that to the rules for generics. Getting back to the point of the thread, the question is how the introduction of generic types changes that, which I'll be the first to admit I don't completely understand. Section 5.2.3 of CDI 1.0, and 5.2.4 of CDI 1.1 seem to be the key. Sincerely, Joe On Sat, Jul 6, 2013 at 10:47 AM, Romain Manni-Bucau <rmannibu...@gmail.com>wrote: > Didnt get your answer, there is no link with Object. A produced generic > type modelizes all possible subtypes IMO (otherwise it should be forbidden > cause it doesnt match original java meaning then) + all beans match Object > in the spec > Le 6 juil. 2013 15:17, "Joseph Bergmark" <bergm...@apache.org> a écrit : > > > For some reason I believe the spec specifically says that Object should > not > > be in the list of types, which I believe is why your plain old java > example > > isn't valid. > > > > Joe > > > > On Sat, Jul 6, 2013 at 6:57 AM, Arne Limburg > > <arne.limb...@openknowledge.de>wrote: > > > > > Hi Romain, > > > > > > > > > In plain old java the assignment does not work either: > > > > > > public class MyClass<T> > > > { > > > ArrayList<T> myTList = ... > > > ArrayList<String> myStringList = myTList; > > > } > > > > > > does not work... > > > > > > And if we have an injection point > > > > > > @Inject String myString; > > > > > > and a Producer > > > > > > @Produces Object myObject; > > > > > > then they don't match. > > > > > > So why should it match with generics? > > > > > > Cheers, > > > Arne > > > > > > Am 06.07.13 12:50 schrieb "Romain Manni-Bucau" unter > > > <rmannibu...@gmail.com>: > > > > > > >So i confirm what i said, ArrayList<T> can be for String, Foo....so i > > > >think > > > >classes should follow it, just match what i expect since i could do it > > in > > > >plain old java > > > >Le 6 juil. 2013 10:18, "Arne Limburg" <arne.limb...@openknowledge.de> > a > > > >écrit : > > > > > > > >> 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 > > > >> <rmannibu...@gmail.com>: > > > >> > > > >> >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" < > arne.limb...@openknowledge.de > > > > > > 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 > > > >> >> > > > >> > > > >> > > > > > > > > >