Status: Resolved (View Workflow)
Affects Version/s: 3.0.2.Final
Fix Version/s: None
(I've posted a summary on StackOverflow.)
In short, it is my understanding that a (valid) producer method returning type X is a bean whose bean types include X and should therefore be observable by a container lifecycle event observer method of the form:
…in addition to being observable by an observer of the ProcessProducerMethod event type.
But in fact it seems to me that the only way an observer of ProcessBean events can get notified of producer methods (a valid kind of bean) is to observe the unbounded wildcard or an equivalent construct, e.g.
(I'm obviously aware that I could define an observer method that observes ProcessProducerMethod events, but I am specifically interested in observing all beans, producers or not, of a particular type.)
I am not sure of the culprit, but after debugging into Weld's innards I found that it looks to my naïve eyes like at some point the type parameters got reversed when Weld builds a ProcessProducerMethod event to fire, but perhaps only in certain cases since observing a ProcessProducerMethod directly works fine.
That is, ProcessBean<X>'s actual type parameter value gets "put" into the T "slot" of ProcessProducerMethod<T, X> when Weld is preparing to notify my general-purpose ProcessBean observer method. Here is the string/debugger output of a Resolvable passed in to TypeSafeResolver#resolve() during the execution of ObserverNotifier#resolveObserverMethods():
It is my understanding from the CDI specification that this should be a ProcessBean<Integer> and a ProcessProducerMethod<Integer, HostBean>, but instead it is a ProcessBean<HostBean> and a ProcessProducerMethod<Integer, HostBean>.
At any rate, I'm unfamiliar with this area of the codebase and may have analyzed it wrongly. My apologies if this is an invalid bug report.