[weld-issues] [JBoss JIRA] Updated: (WELD-454) Observer resolution (event qualifier handling) not in-line with spec

Matthieu Chase Heimer (JIRA) jira-events at lists.jboss.org
Fri Feb 26 19:57:10 EST 2010


     [ https://jira.jboss.org/jira/browse/WELD-454?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matthieu Chase Heimer updated WELD-454:
---------------------------------------

    Affects Version/s: 1.0.1.Final
          Description: 
Page 71 of the spec states: An event is delivered to an observer method if the observer method has *ALL* the event qualifiers. (emphasis mine). The behavior of Weld is if all method qualifiers are present on the event then the method will receive the event. 

//event injection point
@Inject @Q1 @Q2 Event<Color> colorEvent;

//fire event 
colorEvent.fire(Color.BLUE);

//All events have both a Q1 and Q2 qualifier
//only the last method should be called but all four methods are called
public class ColorChangeConsumer {
    public void onAnyColorChange(@Observes Color color) {}

    public void onQ1ColorChange(@Observes @Q1 Color color) {}

    public void onQ2ColorChange(@Observes @Q2 Color color) {}

    public void onQ1QQ2ColorChange(@Observes @Q1 @Q2 Color color) {}
}

This behavior is also seen when using Event.select as seen in the docs: http://docs.jboss.org/weld/reference/1.0.1-Final/en-US/html_single/#d0e4194

  was:
Page 71 of the spec states: An event is delivered to an observer method if the observer method has *ALL* the event qualifiers. (emphasis mine). The behavior of Weld is if *any* matching (including none) qualifiers are present on the method then the method will receive the event. 

//event injection point
@Inject @Q1 @Q2 Event<Color> colorEvent;

//fire event 
colorEvent.fire(Color.BLUE);

//All events have both a Q1 and Q2 qualifier
//only the last method should be called but all four methods are called
public class ColorChangeConsumer {
    public void onAnyColorChange(@Observes Color color) {}

    public void onQ1ColorChange(@Observes @Q1 Color color) {}

    public void onQ2ColorChange(@Observes @Q2 Color color) {}

    public void onQ1QQ2ColorChange(@Observes @Q1 @Q2 Color color) {}
}

This behavior is also seen when using Event.select as seen in the docs: http://docs.jboss.org/weld/reference/1.0.1-Final/en-US/html_single/#d0e4194



Clarified my wording on the current behavior of Weld. Added 1.0.1 Final (didn't realize it was out already)

> Observer resolution (event qualifier handling) not in-line with spec
> --------------------------------------------------------------------
>
>                 Key: WELD-454
>                 URL: https://jira.jboss.org/jira/browse/WELD-454
>             Project: Weld
>          Issue Type: Bug
>          Components: Documentation, Events
>    Affects Versions: 1.0.0.GA, 1.0.1.Final
>         Environment: Windows XP SP3, JDK 1.6 u17, GlassFish v3
>            Reporter: Matthieu Chase Heimer
>
> Page 71 of the spec states: An event is delivered to an observer method if the observer method has *ALL* the event qualifiers. (emphasis mine). The behavior of Weld is if all method qualifiers are present on the event then the method will receive the event. 
> //event injection point
> @Inject @Q1 @Q2 Event<Color> colorEvent;
> //fire event 
> colorEvent.fire(Color.BLUE);
> //All events have both a Q1 and Q2 qualifier
> //only the last method should be called but all four methods are called
> public class ColorChangeConsumer {
>     public void onAnyColorChange(@Observes Color color) {}
>     public void onQ1ColorChange(@Observes @Q1 Color color) {}
>     public void onQ2ColorChange(@Observes @Q2 Color color) {}
>     public void onQ1QQ2ColorChange(@Observes @Q1 @Q2 Color color) {}
> }
> This behavior is also seen when using Event.select as seen in the docs: http://docs.jboss.org/weld/reference/1.0.1-Final/en-US/html_single/#d0e4194

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the weld-issues mailing list