[cdi-dev] [JBoss JIRA] (CDI-517) assignability to parameterized required type

Martin Kouba (JIRA) issues at jboss.org
Tue Mar 10 03:40:18 EDT 2015

    [ https://issues.jboss.org/browse/CDI-517?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13048442#comment-13048442 ] 

Martin Kouba commented on CDI-517:

Well, it was added in this commit [42f5f8ec974e24dfdca5c34eadd3f85785077ca5|https://github.com/cdi-spec/cdi/commit/42f5f8ec974e24dfdca5c34eadd3f85785077ca5] (authored on 25 Feb 2013), the Proposed Final Draft was published on *06 Mar, 2013*, and the Final Release was on *24 May, 2013*. That's enough time for revision. It was also discussed in [DELTASPIKE-295|https://issues.apache.org/jira/browse/DELTASPIKE-295]. So I don't understand your "2 days" sentence.

In any case, it is incompatible in the sense that it *was not defined in CDI 1.0*. And in my opinion it was a mistake.

Also note that it's very easy to fix (and follow the rules explicitly defined in the CDI spec):

Honestly Mark, do you think it's correct to allow something like this?
class Foo<T> {   
  private T ref;
  public Foo(T ref) {
    this.ref = ref;

Foo createFoo() {
 Foo<Integer> foo = new Foo<Integer>(10);
 return foo;

// The producer would be assignable...
Foo<String> stringFoo;

> assignability to parameterized required type
> --------------------------------------------
>                 Key: CDI-517
>                 URL: https://issues.jboss.org/browse/CDI-517
>             Project: CDI Specification Issues
>          Issue Type: Bug
>          Components: Resolution
>    Affects Versions: 1.1.PFD, 1.2.Final
>            Reporter: Mark Struberg
> 2 days before the CDI-1.1 spec went PDF the following backward-incomatible change was made:
> {quote}
> -A raw bean type is considered assignable to a parameterized required type if the raw types are identical.
> + A raw bean type is considered assignable to a parameterized required type if the raw types are identical and all type parameters of the bean type are either unbounded type variables or java.lang.Object.
> {quote} 
> This breaks a lot of projects and also is also not compatible with the JavaEE6 RI and the CDI-1.0 RI where this was explicitly allowed.
> This is a follow up to CDI-304.

This message was sent by Atlassian JIRA

More information about the cdi-dev mailing list