You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by David Blevins <da...@gmail.com> on 2011/06/08 12:01:54 UTC
Observer method resolution
Digging into a test that essentially has two observer methods and is asserting that only one of them are called.
public void observeElephantSessionBean(@Observes ProcessSessionBean<Elephant> event)
{
ProcessBeanObserver.elephantProcessSessionBean = event;
}
public void observeElephantBean(@Observes ProcessBean<Elephant> event)
{
ProcessBeanObserver.elephantProcessBeanCount++;
}
The test is asserting that observeElephantSessionBean is called and that observeElephantBean is not called.
Currently we call both because ProcessSessionBean is assignable to ProcessBean.
Anyone know what part of the spec might lead to this kind of requirement? The spec seems to say in 10.4 pretty clearly:
There may be arbitrarily many observer methods with the same event parameter type and qualifiers.
A bean (or extension) may declare multiple observer methods.
For the interested, the test is org.jboss.jsr299.tck.tests.extensions.processBean.ProcessSessionBeanTest.testProcessSessionBeanEvent
-David
Re: Observer method resolution
Posted by David Jencks <da...@yahoo.com>.
My fix is in rev 1134736. Jira is down at the moment, I'll open an issue for it when it comes back.
Review/comments very welcome :-)
thanks
david jencks
On Jun 11, 2011, at 9:54 AM, David Jencks wrote:
> I think I have a solution for this... more soon.
>
> david jencks
>
> On Jun 10, 2011, at 2:27 PM, David Blevins wrote:
>
>> Looks like this is something we have to fix. See the little example I posted here:
>>
>> https://issues.jboss.org/browse/CDITCK-215?focusedCommentId=12607939&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12607939
>>
>> Anyone want to take a look at fixing this one? (already overloaded)
>>
>>
>> -David
>>
>> On Jun 8, 2011, at 12:27 PM, David Blevins wrote:
>>
>>>
>>> On Jun 8, 2011, at 7:56 AM, Gurkan Erdogdu wrote:
>>>
>>>> Hello David
>>>>
>>>> There are some cases that are explicitly defined in the specification. You can
>>>> open TCK issue from CDI-TCK : https://issues.jboss.org/browse/CDITCK
>>>>
>>>> Seems that our solution to find observer methods is correct!
>>>
>>> That was my thought as well. I can sort of see how it might be useful when looking at it from an overloaded method perspective:
>>>
>>> public void doit(Object o)
>>> public void doit(File f)
>>>
>>> But I don't see any language like that in the spec anywhere.
>>>
>>> I like our way better :) Filed a JIRA
>>>
>>> https://issues.jboss.org/browse/CDITCK-215
>>>
>>>
>>> -David
>>>
>>>> ________________________________
>>>> From: David Blevins <da...@gmail.com>
>>>> To: dev@openwebbeans.apache.org
>>>> Sent: Wed, June 8, 2011 1:01:54 PM
>>>> Subject: Observer method resolution
>>>>
>>>> Digging into a test that essentially has two observer methods and is asserting
>>>> that only one of them are called.
>>>>
>>>> public void observeElephantSessionBean(@Observes ProcessSessionBean<Elephant>
>>>> event)
>>>> {
>>>> ProcessBeanObserver.elephantProcessSessionBean = event;
>>>> }
>>>>
>>>> public void observeElephantBean(@Observes ProcessBean<Elephant> event)
>>>> {
>>>> ProcessBeanObserver.elephantProcessBeanCount++;
>>>> }
>>>>
>>>> The test is asserting that observeElephantSessionBean is called and that
>>>> observeElephantBean is not called.
>>>>
>>>> Currently we call both because ProcessSessionBean is assignable to ProcessBean.
>>>>
>>>> Anyone know what part of the spec might lead to this kind of requirement? The
>>>> spec seems to say in 10.4 pretty clearly:
>>>>
>>>> There may be arbitrarily many observer methods with the same event parameter
>>>> type and qualifiers.
>>>> A bean (or extension) may declare multiple observer methods.
>>>>
>>>>
>>>> For the interested, the test is
>>>> org.jboss.jsr299.tck.tests.extensions.processBean.ProcessSessionBeanTest.testProcessSessionBeanEvent
>>>>
>>>>
>>>>
>>>> -David
>>>
>>
>
Re: Observer method resolution
Posted by David Jencks <da...@yahoo.com>.
I think I have a solution for this... more soon.
david jencks
On Jun 10, 2011, at 2:27 PM, David Blevins wrote:
> Looks like this is something we have to fix. See the little example I posted here:
>
> https://issues.jboss.org/browse/CDITCK-215?focusedCommentId=12607939&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12607939
>
> Anyone want to take a look at fixing this one? (already overloaded)
>
>
> -David
>
> On Jun 8, 2011, at 12:27 PM, David Blevins wrote:
>
>>
>> On Jun 8, 2011, at 7:56 AM, Gurkan Erdogdu wrote:
>>
>>> Hello David
>>>
>>> There are some cases that are explicitly defined in the specification. You can
>>> open TCK issue from CDI-TCK : https://issues.jboss.org/browse/CDITCK
>>>
>>> Seems that our solution to find observer methods is correct!
>>
>> That was my thought as well. I can sort of see how it might be useful when looking at it from an overloaded method perspective:
>>
>> public void doit(Object o)
>> public void doit(File f)
>>
>> But I don't see any language like that in the spec anywhere.
>>
>> I like our way better :) Filed a JIRA
>>
>> https://issues.jboss.org/browse/CDITCK-215
>>
>>
>> -David
>>
>>> ________________________________
>>> From: David Blevins <da...@gmail.com>
>>> To: dev@openwebbeans.apache.org
>>> Sent: Wed, June 8, 2011 1:01:54 PM
>>> Subject: Observer method resolution
>>>
>>> Digging into a test that essentially has two observer methods and is asserting
>>> that only one of them are called.
>>>
>>> public void observeElephantSessionBean(@Observes ProcessSessionBean<Elephant>
>>> event)
>>> {
>>> ProcessBeanObserver.elephantProcessSessionBean = event;
>>> }
>>>
>>> public void observeElephantBean(@Observes ProcessBean<Elephant> event)
>>> {
>>> ProcessBeanObserver.elephantProcessBeanCount++;
>>> }
>>>
>>> The test is asserting that observeElephantSessionBean is called and that
>>> observeElephantBean is not called.
>>>
>>> Currently we call both because ProcessSessionBean is assignable to ProcessBean.
>>>
>>> Anyone know what part of the spec might lead to this kind of requirement? The
>>> spec seems to say in 10.4 pretty clearly:
>>>
>>> There may be arbitrarily many observer methods with the same event parameter
>>> type and qualifiers.
>>> A bean (or extension) may declare multiple observer methods.
>>>
>>>
>>> For the interested, the test is
>>> org.jboss.jsr299.tck.tests.extensions.processBean.ProcessSessionBeanTest.testProcessSessionBeanEvent
>>>
>>>
>>>
>>> -David
>>
>
Re: Observer method resolution
Posted by David Blevins <da...@gmail.com>.
Looks like this is something we have to fix. See the little example I posted here:
https://issues.jboss.org/browse/CDITCK-215?focusedCommentId=12607939&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12607939
Anyone want to take a look at fixing this one? (already overloaded)
-David
On Jun 8, 2011, at 12:27 PM, David Blevins wrote:
>
> On Jun 8, 2011, at 7:56 AM, Gurkan Erdogdu wrote:
>
>> Hello David
>>
>> There are some cases that are explicitly defined in the specification. You can
>> open TCK issue from CDI-TCK : https://issues.jboss.org/browse/CDITCK
>>
>> Seems that our solution to find observer methods is correct!
>
> That was my thought as well. I can sort of see how it might be useful when looking at it from an overloaded method perspective:
>
> public void doit(Object o)
> public void doit(File f)
>
> But I don't see any language like that in the spec anywhere.
>
> I like our way better :) Filed a JIRA
>
> https://issues.jboss.org/browse/CDITCK-215
>
>
> -David
>
>> ________________________________
>> From: David Blevins <da...@gmail.com>
>> To: dev@openwebbeans.apache.org
>> Sent: Wed, June 8, 2011 1:01:54 PM
>> Subject: Observer method resolution
>>
>> Digging into a test that essentially has two observer methods and is asserting
>> that only one of them are called.
>>
>> public void observeElephantSessionBean(@Observes ProcessSessionBean<Elephant>
>> event)
>> {
>> ProcessBeanObserver.elephantProcessSessionBean = event;
>> }
>>
>> public void observeElephantBean(@Observes ProcessBean<Elephant> event)
>> {
>> ProcessBeanObserver.elephantProcessBeanCount++;
>> }
>>
>> The test is asserting that observeElephantSessionBean is called and that
>> observeElephantBean is not called.
>>
>> Currently we call both because ProcessSessionBean is assignable to ProcessBean.
>>
>> Anyone know what part of the spec might lead to this kind of requirement? The
>> spec seems to say in 10.4 pretty clearly:
>>
>> There may be arbitrarily many observer methods with the same event parameter
>> type and qualifiers.
>> A bean (or extension) may declare multiple observer methods.
>>
>>
>> For the interested, the test is
>> org.jboss.jsr299.tck.tests.extensions.processBean.ProcessSessionBeanTest.testProcessSessionBeanEvent
>>
>>
>>
>> -David
>
Re: Observer method resolution
Posted by David Blevins <da...@gmail.com>.
On Jun 8, 2011, at 7:56 AM, Gurkan Erdogdu wrote:
> Hello David
>
> There are some cases that are explicitly defined in the specification. You can
> open TCK issue from CDI-TCK : https://issues.jboss.org/browse/CDITCK
>
> Seems that our solution to find observer methods is correct!
That was my thought as well. I can sort of see how it might be useful when looking at it from an overloaded method perspective:
public void doit(Object o)
public void doit(File f)
But I don't see any language like that in the spec anywhere.
I like our way better :) Filed a JIRA
https://issues.jboss.org/browse/CDITCK-215
-David
> ________________________________
> From: David Blevins <da...@gmail.com>
> To: dev@openwebbeans.apache.org
> Sent: Wed, June 8, 2011 1:01:54 PM
> Subject: Observer method resolution
>
> Digging into a test that essentially has two observer methods and is asserting
> that only one of them are called.
>
> public void observeElephantSessionBean(@Observes ProcessSessionBean<Elephant>
> event)
> {
> ProcessBeanObserver.elephantProcessSessionBean = event;
> }
>
> public void observeElephantBean(@Observes ProcessBean<Elephant> event)
> {
> ProcessBeanObserver.elephantProcessBeanCount++;
> }
>
> The test is asserting that observeElephantSessionBean is called and that
> observeElephantBean is not called.
>
> Currently we call both because ProcessSessionBean is assignable to ProcessBean.
>
> Anyone know what part of the spec might lead to this kind of requirement? The
> spec seems to say in 10.4 pretty clearly:
>
> There may be arbitrarily many observer methods with the same event parameter
> type and qualifiers.
> A bean (or extension) may declare multiple observer methods.
>
>
> For the interested, the test is
> org.jboss.jsr299.tck.tests.extensions.processBean.ProcessSessionBeanTest.testProcessSessionBeanEvent
>
>
>
> -David
Re: Observer method resolution
Posted by Gurkan Erdogdu <gu...@yahoo.com>.
Hello David
There are some cases that are explicitly defined in the specification. You can
open TCK issue from CDI-TCK : https://issues.jboss.org/browse/CDITCK
Seems that our solution to find observer methods is correct!
--Gurkan
________________________________
From: David Blevins <da...@gmail.com>
To: dev@openwebbeans.apache.org
Sent: Wed, June 8, 2011 1:01:54 PM
Subject: Observer method resolution
Digging into a test that essentially has two observer methods and is asserting
that only one of them are called.
public void observeElephantSessionBean(@Observes ProcessSessionBean<Elephant>
event)
{
ProcessBeanObserver.elephantProcessSessionBean = event;
}
public void observeElephantBean(@Observes ProcessBean<Elephant> event)
{
ProcessBeanObserver.elephantProcessBeanCount++;
}
The test is asserting that observeElephantSessionBean is called and that
observeElephantBean is not called.
Currently we call both because ProcessSessionBean is assignable to ProcessBean.
Anyone know what part of the spec might lead to this kind of requirement? The
spec seems to say in 10.4 pretty clearly:
There may be arbitrarily many observer methods with the same event parameter
type and qualifiers.
A bean (or extension) may declare multiple observer methods.
For the interested, the test is
org.jboss.jsr299.tck.tests.extensions.processBean.ProcessSessionBeanTest.testProcessSessionBeanEvent
-David