Right now, the following observers are forbidden cannot be declared *on an extension* : {code:java} void first(@Observes Object foo, Bar bar) { } void second(@Observes @Foo Object foo, Bar bar) { } {code} whereas this one is allowed: {code:java} void third(@Observes Foo foo, Bar bar) { } {code}
Note that the *first* observer would be notified even for container lifecycle events and so it's considered a _container lifecycle event observer_. However, the *second* observer is incorrectly considered a _container lifecycle event observer_ too.
{{Observers.isContainerLifecycleObserverMethod()}} should return false for an observer with observed type {{java.lang.Object}} and a qualifier other than {{@Any}}.
Note that all the above observers are defined as non-portable in the spec. The problem is that extensions can communicate using events and so the required beans may be not discovered/available yet.
However, I think Weld should be consistent here. If *third* is allowed, the *second* should be allowed too. |
|