<p style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">+1, if we are no more aligned on something so simple in plain java we are useless i fear :(</p><p style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">

(i used and saw it used in a lot of real apps)</p><p style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br></p><div><div><i>Romain Manni-Bucau</i></div><div><i>Twitter: <a href="https://twitter.com/rmannibucau" target="_blank">@rmannibucau</a></i></div>

<div><i>Blog: </i><a href="http://rmannibucau.wordpress.com/" target="_blank"><i>http://rmannibucau.wordpress.com/</i></a></div><div><i>LinkedIn: </i><font color="#0000ee"><i><u><a href="http://fr.linkedin.com/in/rmannibucau" target="_blank">http://fr.linkedin.com/in/rmannibucau</a></u></i></font></div>

<div><i><span style="background-color:rgb(255,255,255)">Github: </span><a href="https://github.com/rmannibucau" target="_blank">https://github.com/rmannibucau</a></i></div><div><br></div></div>
<br><br><div class="gmail_quote">2013/7/14 Mark Struberg <span dir="ltr">&lt;<a href="mailto:struberg@yahoo.de" target="_blank">struberg@yahoo.de</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

folks, this breaks backward compatibility<br>
<br>
<br>
In CDI 1.0 it was perfectly fine to do the following<br>
<br>
    @Produces<br>
    @Dependent<br>
    public &lt;KEY, VALUE extends Serializable&gt; Cache&lt;KEY, VALUE&gt; getDefaultCache(InjectionPoint injectionPoint) {<br>
        Type ipType = injectionPoint.getType();<br>
        String cacheName = null;<br>
<br>
        if (ipType instanceof ParameterizedType) {<br>
            ParameterizedType generic = (ParameterizedType) ipType;<br>
            Type[] paramTypes = generic.getActualTypeArguments();<br>
            if (paramTypes == null || paramTypes.length != 2) {<br>
                throw new RuntimeException(&quot;illegal param types for generic type &quot; + ipType);<br>
            }<br>
<br>
            if (paramTypes[1] instanceof Class) {<br>
                cacheName = ((Class) paramTypes[1]).getSimpleName();<br>
            }<br>
            else {<br>
                cacheName = paramTypes[1].toString();<br>
            }<br>
        }<br>
<br>
        return getCache(cacheName);<br>
    }<br>
<br>
<br>
<br>
usage:<br>
<br>
<br>
@Inject<br>
private Cache&lt;String, IdmUser&gt; userCache;<br>
<br>
<br>
With your new interpretation you basically trash this, right?<br>
For having a generic producer you would need to create a distinct producer method for each and every usage. This just doesn&#39;t work out in practice...<br>
<div class="im HOEnZb"><br>
<br>
<br>
LieGrue,<br>
strub<br>
<br>
<br>
<br>
<br>
<br>
----- Original Message -----<br>
From: Martin Kouba &lt;<a href="mailto:mkouba@redhat.com">mkouba@redhat.com</a>&gt;<br>
</div><div class="im HOEnZb">To: Arne Limburg &lt;<a href="mailto:arne.limburg@openknowledge.de">arne.limburg@openknowledge.de</a>&gt;<br>
Cc: &quot;<a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a>&quot; &lt;<a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a>&gt;<br>
Sent: Wednesday, 10 July 2013, 14:01<br>
Subject: Re: [cdi-dev] CDI and generics<br>
<br>
</div><div class="HOEnZb"><div class="h5">No, it&#39;s not necessary. We&#39;ll fix this within CDITCK-349 [1]. Leave a<br>
comment if you wish :-)<br>
<br>
Thanks<br>
Martin<br>
<br>
[1]<br>
<a href="https://issues.jboss.org/browse/CDITCK-349" target="_blank">https://issues.jboss.org/browse/CDITCK-349</a><br>
<br>
<br>
Dne 10.7.2013 13:52, Arne Limburg napsal(a):<br>
&gt; OK, so shall I create a TCK issue for that?<br>
&gt;<br>
&gt;<br>
&gt; Cheers,<br>
&gt; Arne<br>
&gt;<br>
&gt; Am 10.07.13 13:50 schrieb &quot;Martin Kouba&quot; unter &lt;<a href="mailto:mkouba@redhat.com">mkouba@redhat.com</a>&gt;:<br>
&gt;<br>
&gt;&gt; Hi Arne,<br>
&gt;&gt;<br>
&gt;&gt; I think so (except the required type is Baz&lt;List&lt;Qux&gt;&gt;) - there is no<br>
&gt;&gt; bean with assignable bean type for this IP (according to CDI 1.1 rules<br>
&gt;&gt; of course).<br>
&gt;&gt;<br>
&gt;&gt; Martin<br>
&gt;&gt;<br>
&gt;&gt; Dne 10.7.2013 13:16, Arne Limburg napsal(a):<br>
&gt;&gt;&gt; Hi Martin,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; So, which bean should be injected into<br>
&gt;&gt;&gt; @Inject<br>
&gt;&gt;&gt;     private Baz&lt;List&lt;T2&gt;&gt; t2BazList;<br>
&gt;&gt;&gt; ?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Baz&lt;T&gt; is also not assignable to Baz&lt;List&lt;String&gt;&gt;, because List&lt;String&gt;<br>
&gt;&gt;&gt; is also not assignable from Object.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Am I right, that the test should throw an<br>
&gt;&gt;&gt; UnsatisfiedResolutionException?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Cheers,<br>
&gt;&gt;&gt; Arne<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Am 08.07.13 12:17 schrieb &quot;Martin Kouba&quot; unter &lt;<a href="mailto:mkouba@redhat.com">mkouba@redhat.com</a>&gt;:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Re Arne&#39;s question:<br>
&gt;&gt;&gt;&gt; Yes, Baz is a managed bean and AmbiguousResolutionException should not<br>
&gt;&gt;&gt;&gt; be thrown because Qux is not a managed bean (doesn&#39;t have a public<br>
&gt;&gt;&gt;&gt; no-arg constructor).<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Re Marko&#39;s findings:<br>
&gt;&gt;&gt;&gt; Yes, the TCK assertions are not up to date and Baz&lt;T&gt; is not assignable<br>
&gt;&gt;&gt;&gt; to Baz&lt;String&gt;, because String is not assignable from Object (no bound<br>
&gt;&gt;&gt;&gt; is defined -&gt; Object is assumed; see JSL 4.4). So I confirm a TCK<br>
&gt;&gt;&gt;&gt; issue.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; IMO this would deserve a proper cleanup...<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Martin<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Dne 8.7.2013 01:22, Marko Lukša napsal(a):<br>
&gt;&gt;&gt;&gt;&gt; I&#39;d say it&#39;s a bug. While Baz indeed is a managed bean, it shouldn&#39;t<br>
&gt;&gt;&gt;&gt;&gt; be<br>
&gt;&gt;&gt;&gt;&gt; injected into injection point with type Baz&lt;String&gt; nor<br>
&gt;&gt;&gt;&gt;&gt; Baz&lt;List&lt;Qux&gt;&gt;.<br>
&gt;&gt;&gt;&gt;&gt; So I believe you&#39;re right in saying that this test should fail with<br>
&gt;&gt;&gt;&gt;&gt; UnsatisfiedResolutionException.<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; There was a change made to the spec way back in 2010 (see [1]), but<br>
&gt;&gt;&gt;&gt;&gt; the<br>
&gt;&gt;&gt;&gt;&gt; TCK apparently wasn&#39;t updated then. I&#39;ve filed an issue in the TCK<br>
&gt;&gt;&gt;&gt;&gt; jira<br>
&gt;&gt;&gt;&gt;&gt; [2].<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; The problem isn&#39;t only in the TCK, but also in the spec itself. Some<br>
&gt;&gt;&gt;&gt;&gt; of<br>
&gt;&gt;&gt;&gt;&gt; the examples in section 5.2.4 don&#39;t conform to the rules defined in<br>
&gt;&gt;&gt;&gt;&gt; the<br>
&gt;&gt;&gt;&gt;&gt; same section (according to the rules, bean Dao&lt;T extends Persistent&gt;<br>
&gt;&gt;&gt;&gt;&gt; shouldn&#39;t be eligible for injection into Dao&lt;Order&gt; or Dao&lt;User&gt;). I<br>
&gt;&gt;&gt;&gt;&gt; remember asking about this a year ago ([3]), but I didn&#39;t articulate<br>
&gt;&gt;&gt;&gt;&gt; the<br>
&gt;&gt;&gt;&gt;&gt; problem properly.<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; [1]<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; <a href="https://github.com/cdi-spec/cdi/commit/b32243350ace6a0bba337f91a35f5fd0" target="_blank">https://github.com/cdi-spec/cdi/commit/b32243350ace6a0bba337f91a35f5fd0</a><br>
&gt;&gt;&gt;&gt;&gt; 5c<br>
&gt;&gt;&gt;&gt;&gt; 151f14<br>
&gt;&gt;&gt;&gt;&gt; [2] <a href="https://issues.jboss.org/browse/CDITCK-349" target="_blank">https://issues.jboss.org/browse/CDITCK-349</a><br>
&gt;&gt;&gt;&gt;&gt; [3] <a href="http://lists.jboss.org/pipermail/cdi-dev/2012-April/001742.html" target="_blank">http://lists.jboss.org/pipermail/cdi-dev/2012-April/001742.html</a><br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; Marko<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; On 7.7.2013 16:04, Arne Limburg wrote:<br>
&gt;&gt;&gt;&gt;&gt;&gt; Hi all,<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; At the OpenWebBeans list we are currently discussing handling of<br>
&gt;&gt;&gt;&gt;&gt;&gt; generics in CDI.<br>
&gt;&gt;&gt;&gt;&gt;&gt; I found a test in the CDI 1.1 TCK, which imho has a bug. The test<br>
&gt;&gt;&gt;&gt;&gt;&gt; is<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; org.jboss.cdi.tck.tests.inheritance.generics.MemberLevelInheritanceTes<br>
&gt;&gt;&gt;&gt;&gt;&gt; t<br>
&gt;&gt;&gt;&gt;&gt;&gt; and the (simplified) deployment scenario is the following:<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; public class Baz&lt;T&gt; {<br>
&gt;&gt;&gt;&gt;&gt;&gt; }<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; public class Qux extends Baz&lt;String&gt; {<br>
&gt;&gt;&gt;&gt;&gt;&gt; }<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; @Vetoed<br>
&gt;&gt;&gt;&gt;&gt;&gt; public class Bar&lt;T1, T2&gt; {<br>
&gt;&gt;&gt;&gt;&gt;&gt;   @Inject<br>
&gt;&gt;&gt;&gt;&gt;&gt;   private Baz&lt;T1&gt; baz;<br>
&gt;&gt;&gt;&gt;&gt;&gt;   @Inject<br>
&gt;&gt;&gt;&gt;&gt;&gt;   private Baz&lt;List&lt;T2&gt;&gt; t2BazList;<br>
&gt;&gt;&gt;&gt;&gt;&gt; }<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; @RequestScoped<br>
&gt;&gt;&gt;&gt;&gt;&gt; public class Foo extends Bar&lt;String, Qux&gt; {<br>
&gt;&gt;&gt;&gt;&gt;&gt; }<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; public class Producer {<br>
&gt;&gt;&gt;&gt;&gt;&gt;   @Produces<br>
&gt;&gt;&gt;&gt;&gt;&gt;   @Amazing<br>
&gt;&gt;&gt;&gt;&gt;&gt;   public String produceString() {<br>
&gt;&gt;&gt;&gt;&gt;&gt;     return &quot;ok&quot;;<br>
&gt;&gt;&gt;&gt;&gt;&gt;   }<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;   @Produces<br>
&gt;&gt;&gt;&gt;&gt;&gt;   public String[] produceStringArray() {<br>
&gt;&gt;&gt;&gt;&gt;&gt;     return new String[0];<br>
&gt;&gt;&gt;&gt;&gt;&gt;   }<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;   @Produces<br>
&gt;&gt;&gt;&gt;&gt;&gt;   public Baz&lt;Baz&lt;Qux&gt;&gt; produceBazBazQux() {<br>
&gt;&gt;&gt;&gt;&gt;&gt;     return new Baz();<br>
&gt;&gt;&gt;&gt;&gt;&gt;   }<br>
&gt;&gt;&gt;&gt;&gt;&gt; }<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; The class Bar has some more injection points, but that does not<br>
&gt;&gt;&gt;&gt;&gt;&gt; matter.<br>
&gt;&gt;&gt;&gt;&gt;&gt; Due to the TCK this deployment should work, but I don&#39;t know how.<br>
&gt;&gt;&gt;&gt;&gt;&gt; Question: Is Baz a Bean (I suppose so) and may it be injected into<br>
&gt;&gt;&gt;&gt;&gt;&gt; Bean Foo, more precisely into the second injection point of class<br>
&gt;&gt;&gt;&gt;&gt;&gt; Bar?<br>
&gt;&gt;&gt;&gt;&gt;&gt; - If yes, it also should be injected into the first injection<br>
&gt;&gt;&gt;&gt;&gt;&gt; point, right? This would lead to an AmbiguousResolutionException<br>
&gt;&gt;&gt;&gt;&gt;&gt; since<br>
&gt;&gt;&gt;&gt;&gt;&gt; Qux may also be injected into the first injection point.<br>
&gt;&gt;&gt;&gt;&gt;&gt; - If no, the deployment should fail with a<br>
&gt;&gt;&gt;&gt;&gt;&gt; UnsatisfiedResolutionException since there is no Bean that can be<br>
&gt;&gt;&gt;&gt;&gt;&gt; injected into that injection point.<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; Is this a bug in the TCK and if not, how is this supposed to work?<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; Cheers,<br>
&gt;&gt;&gt;&gt;&gt;&gt; Arne<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt;&gt;&gt;&gt; cdi-dev mailing list<br>
&gt;&gt;&gt;&gt;&gt;&gt; <a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
&gt;&gt;&gt;&gt;&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt;&gt;&gt; cdi-dev mailing list<br>
&gt;&gt;&gt;&gt;&gt; <a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
&gt;&gt;&gt;&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt;&gt; cdi-dev mailing list<br>
&gt;&gt;&gt;&gt; <a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
&gt;&gt;&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
&gt;&gt;&gt;<br>
&gt;<br>
<br>
_______________________________________________<br>
cdi-dev mailing list<br>
<a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
<br>
_______________________________________________<br>
cdi-dev mailing list<br>
<a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/cdi-dev</a></div></div></blockquote></div><br>