[weld-issues] [JBoss JIRA] (WELD-978) Cannot fire event with parameterized type as a payload

Jozef Hartinger (Commented) (JIRA) jira-events at lists.jboss.org
Tue Oct 11 03:14:16 EDT 2011


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

Jozef Hartinger commented on WELD-978:
--------------------------------------

Yes, technically it is possible to detect a type variable using selected type for Event instances (either the one from the injection point or the one passed to select). However, even in this case the specification puts restrictions on the Java type of the event object instead of restricting the selected type.

{quote}
If the runtime type of the event object contains a type variable, the container must throw an IllegalArgumentException.
{quote}

Thus, it is not possible to support parameterized event payloads (even with Event) while at the same time react with IAE if the payload happens to have a type variable (since we cannot distinguish at runtime).

In order to implement support for parameterized event payload we would have to ignore the following parts of the spec:
* {quote}If the runtime type of the event object contains a type variable, the container must throw an IllegalArgumentException.{quote}
* {quote}An event object is an instance of a concrete Java class with no type variables.{quote}
                
> Cannot fire event with parameterized type as a payload
> ------------------------------------------------------
>
>                 Key: WELD-978
>                 URL: https://issues.jboss.org/browse/WELD-978
>             Project: Weld
>          Issue Type: Bug
>    Affects Versions: 1.1.2.Final
>            Reporter: Martin Kouba
>
> It should be possible to fire event with parameterized type as a payload.
> See CDI 1.0 spec chapter *10.1. Event types and qualifier types*.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the weld-issues mailing list