[cdi-dev] [JBoss JIRA] (CDI-422) Wrong example for event qualifier types with members

Antoine Sabot-Durand (JIRA) issues at jboss.org
Tue Mar 4 05:51:33 EST 2014

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

Antoine Sabot-Durand commented on CDI-422:

Right [~mkouba]. Nice catch ;). I added this to 1.2.
I have two remarks on this :

# There are other wrong example after this one assuming the existence of this qualifier param in {{javax.enterprise.event.Event.fire()}} method. In 10.2.3 for instance 
   documentEvent.fire( document, new UpdatedQualifier() {}, new ByAdminQualifier() {} );
# After the correction, theses examples, in order to be valid, should add {{@Inject @Any Event<LoggedInEvent> loggedInEvent;}} . But the notion of Injecting {{@Any Event<T>}} is introduced in part _10.3 Firing events_. To make the chapter easier to understand I propose to switch 10.2 and 10.3 (it doesn't sound stupid to deal with firing event before dealing with observer by the way).

> Wrong example for event qualifier types with members
> ----------------------------------------------------
>                 Key: CDI-422
>                 URL: https://issues.jboss.org/browse/CDI-422
>             Project: CDI Specification Issues
>          Issue Type: Bug
>          Components: Events
>            Reporter: Martin Kouba
>            Priority: Minor
>              Labels: CDI_spec_chge
>             Fix For: 1.2 Proposed
> The following snippet in "10.2.2 Event qualifier types with members" is wrong:
> {code}
> public void login() {
> final User user = ...;
> loggedInEvent.fire( new LoggedInEvent(user),
> new RoleQualifier() { public String value() { return user.getRole(); } );
> }
> {code}
> {{javax.enterprise.event.Event.fire()}} method does not have qualifiers param. The example should either use {{Event.select(Annotation...)}} along with  {{Event.fire()}} or {{BeanManager.fireEvent(Object, Annotation...)}}.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

More information about the cdi-dev mailing list