[cdi-dev] [JBoss JIRA] Commented: (CDI-169) Remove the 'No type variable in event objects' restriction

Martin Kouba (JIRA) jira-events at lists.jboss.org
Tue Sep 27 13:18:27 EDT 2011


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

Martin Kouba commented on CDI-169:
----------------------------------

To summarize the problem. CDI 1.0 spec *does allow* to use parameterized type as an event payload (e.g. ProcessBean<Foo>) and it *does not allow* to use type variable in event payload (e.g. ProcessBean<T>). See links in [comment #1|https://issues.jboss.org/browse/CDI-169?focusedCommentId=12630650&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12630650] to understand the difference.

There is a bug in Weld so that it's not possible to fire events with parametrized types as a payload (somehow hacked around in case of container lifecycle events). However it is possible to observe such events (for example some container lifecycle events).

TCK test *org.jboss.jsr299.tck.tests.event.fires.FireEventTest.testTypeVariableEventTypeFails()* is also wrong.

It is a subject of discussion whether to *allow* and *how to implement* type variable in event payload in CDI 1.1 spec.

> Remove the 'No type variable in event objects' restriction
> ----------------------------------------------------------
>
>                 Key: CDI-169
>                 URL: https://issues.jboss.org/browse/CDI-169
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>    Affects Versions: 1.0
>            Reporter: Stuart Douglas
>             Fix For: 1.1 (Proposed)
>
>
> CDI 10.1 states:
> An event object is an instance of a concrete Java class with no type variables. ... An event type may not contain a type variable.
> Which seems silly considering the container fires events with a type variable at startup. I can't think of any reason why this should be prohibited. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the cdi-dev mailing list