[cdi-dev] CDI and generics

Arne Limburg arne.limburg at openknowledge.de
Sun Jul 7 10:04:35 EDT 2013

Hi all,

At the OpenWebBeans list we are currently discussing handling of generics in CDI.
I found a test in the CDI 1.1 TCK, which imho has a bug. The test is org.jboss.cdi.tck.tests.inheritance.generics.MemberLevelInheritanceTest and the (simplified) deployment scenario is the following:

public class Baz<T> {

public class Qux extends Baz<String> {

public class Bar<T1, T2> {
  private Baz<T1> baz;
  private Baz<List<T2>> t2BazList;

public class Foo extends Bar<String, Qux> {

public class Producer {
  public String produceString() {
    return "ok";

  public String[] produceStringArray() {
    return new String[0];

  public Baz<Baz<Qux>> produceBazBazQux() {
    return new Baz();

The class Bar has some more injection points, but that does not matter.
Due to the TCK this deployment should work, but I don't know how.
Question: Is Baz a Bean (I suppose so) and may it be injected into Bean Foo, more precisely into the second injection point of class Bar?
- If yes, it also should be injected into the first injection point, right? This would lead to an AmbiguousResolutionException since Qux may also be injected into the first injection point.
- If no, the deployment should fail with a UnsatisfiedResolutionException since there is no Bean that can be injected into that injection point.

Is this a bug in the TCK and if not, how is this supposed to work?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20130707/4ef662a0/attachment.html 

More information about the cdi-dev mailing list