[ 
https://issues.apache.org/jira/browse/OWB-667?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13274483#comment-13274483
 ] 

Mark Struberg commented on OWB-667:
-----------------------------------

I can explain this point: the candidate type of a bean is it's type plus all 
it's interfaces and superclasses. The same is true for an @Alternative. Having 
a class

@Alternative
public class MyBean extends X, implements Y {..

gives you the following Type[]: {MyBean, X, Y, Object}.

@Alternative is (way too shortly) defined (chapter 2.6.3, 4.3) and use the 
matching algorithm defined in 5.2.1:

>When an ambiguous dependency exists, the container attempts to resolve the 
>ambiguity. 
> The container eliminates all eligible beans that are not alternatives, except 
> for 
> producer methods and fields of beans that are alternatives. If there is ex- 
> actly one bean
>  remaining, the container will select this bean, and the ambiguous dependency 
> is called resolvable.

What neither the spec nor the javadoc say is whether this should happen in 
getBeans() or in resolve().
I'll try to _again_ clarify this with the EG. 

                
> Bean queries have strange behavior (difference between Open Web Beans and the 
> Reference Implementation)
> -------------------------------------------------------------------------------------------------------
>
>                 Key: OWB-667
>                 URL: https://issues.apache.org/jira/browse/OWB-667
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.1.4
>         Environment: All
>            Reporter: Phil Oser
>            Assignee: Gurkan Erdogdu
>         Attachments: cdi-boot.zip
>
>
> We use the BeanManager#getBeans(java.lang.reflect.Type, 
> java.lang.annotation.Annotation...) to find all beans of a certain type (to 
> implement something like a service locator).
> As soon as one of the beans is an activated Alternative, the list of matching 
> beans is reduced to this activated Alternative.
> The expected behavior is present in the Reference Implementation. 
> Please refer to the attached test cases.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to