[cdi-dev] [JBoss JIRA] (CDI-277) Clarify inheritance behavior of observer methods

Mark Struberg (JIRA) jira-events at lists.jboss.org
Sat Oct 13 07:20:01 EDT 2012

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

Mark Struberg commented on CDI-277:

There is another paragraph in the spec where this gets covered:

10.2. Observer resolution
An event is delivered to an observer method if:
• The observer method belongs to an enabled bean.

In my opinion the following must get clarified:

1.) This bullet clearly disables veto() beans from receiving Observers, right?
2.) @Alternative has no influence on Observers at all! They do not disable beans but only affect the resolution process.
3.) A @Specializes class Y must be a subclass of another class X. If X defines an observer method then this is also part of class Y and thus will get called.
4.) Any Reception.ALWAYS Observer method in X will NOT create a contextual instance of X but _only_ of type Y (as X is not an enabled bean)

What I'm asking me is how one can disable a private observer method in it's superclass or a static observer method at all ^^ Probably only via Extensions.
What if there are 2 Observer methods, both private and with the exact same name and signature, but in different levels in the class hierarchy? Guess both will get triggered, right?
> Clarify inheritance behavior of observer methods
> ------------------------------------------------
>                 Key: CDI-277
>                 URL: https://issues.jboss.org/browse/CDI-277
>             Project: CDI Specification Issues
>          Issue Type: Clarification
>            Reporter: Arne Limburg
> Chapter 4.2 of the (1.0) spec misses a bullet point about inheritance of observer methods.
> Either
> - If X declares a non-static observer method x() then Y does inherit this method.
> or
> - If X declares a non-static observer method x() then Y does not inherit this method.
> (This behavior is different to what is defined in the Common Annotations for the Java Platform specification.)
> should be added.
> Don't know, what's right through...

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