You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Andreas Erne (Created) (JIRA)" <ji...@apache.org> on 2012/03/28 16:27:28 UTC

[jira] [Created] (OWB-658) BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans

BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans
----------------------------------------------------------------------------------

                 Key: OWB-658
                 URL: https://issues.apache.org/jira/browse/OWB-658
             Project: OpenWebBeans
          Issue Type: Bug
          Components: Injection and Lookup
    Affects Versions: 1.1.3
            Reporter: Andreas Erne
            Assignee: Gurkan Erdogdu


Expected behaviour: beanManager.getBeans(Object.class, new ServiceQualifier()) finds all beans that are qualified as "Service", regardless of the beans implementation type

Effective behaviour: The BeanManager fails if a base type (Object in this example) is provided instead of a leaf type. In theses cases, the BeanManager finds the Alternative beans only and forgets about all beans that lack of an Alternative

Reason: The BeanManager's helper org.apache.webbeans.container.InjectionResolver fails in method implResolveByType method as it can not handle collections of beans of different types. It treats all beans as if they where of the same type (and therefore have the same Alternative)

--
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

        

[jira] [Commented] (OWB-658) BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans

Posted by "Mark Struberg (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13243689#comment-13243689 ] 

Mark Struberg commented on OWB-658:
-----------------------------------

This might need some bigger change. In case of an isAlternative(), we should also store for which types! This is typically needed if a 

> public class MyBean implements ServiceA, ServiceB {};

> public class @Alternative MyAlternative implements ServiceA

Thus for
> private @Inject ServiceA a; 
you will get an instance of MyAlternative.

But for 
> private @Inject ServiceB b; 
you will get an instance of MyBean.
                
> BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans
> ----------------------------------------------------------------------------------
>
>                 Key: OWB-658
>                 URL: https://issues.apache.org/jira/browse/OWB-658
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Injection and Lookup
>    Affects Versions: 1.1.3
>            Reporter: Andreas Erne
>            Assignee: Mark Struberg
>             Fix For: 1.1.4
>
>
> Expected behaviour: beanManager.getBeans(Object.class, new ServiceQualifier()) finds all beans that are qualified as "Service", regardless of the beans implementation type
> Effective behaviour: The BeanManager fails if a base type (Object in this example) is provided instead of a leaf type. In theses cases, the BeanManager finds the Alternative beans only and forgets about all beans that lack of an Alternative
> Reason: The BeanManager's helper org.apache.webbeans.container.InjectionResolver fails in method implResolveByType method as it can not handle collections of beans of different types. It treats all beans as if they where of the same type (and therefore have the same Alternative)

--
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

        

[jira] [Reopened] (OWB-658) BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans

Posted by "Andreas Erne (Reopened) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OWB-658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Erne reopened OWB-658:
------------------------------


I tested the 1.1.4-SNAPSHOT and found the results promising but by far not "fixed". Therefore I'd like to reopen this issue.
                
> BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans
> ----------------------------------------------------------------------------------
>
>                 Key: OWB-658
>                 URL: https://issues.apache.org/jira/browse/OWB-658
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Injection and Lookup
>    Affects Versions: 1.1.3
>            Reporter: Andreas Erne
>            Assignee: Mark Struberg
>             Fix For: 1.1.4
>
>
> Expected behaviour: beanManager.getBeans(Object.class, new ServiceQualifier()) finds all beans that are qualified as "Service", regardless of the beans implementation type
> Effective behaviour: The BeanManager fails if a base type (Object in this example) is provided instead of a leaf type. In theses cases, the BeanManager finds the Alternative beans only and forgets about all beans that lack of an Alternative
> Reason: The BeanManager's helper org.apache.webbeans.container.InjectionResolver fails in method implResolveByType method as it can not handle collections of beans of different types. It treats all beans as if they where of the same type (and therefore have the same Alternative)

--
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

        

[jira] [Commented] (OWB-658) BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans

Posted by "Andreas Erne (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13246261#comment-13246261 ] 

Andreas Erne commented on OWB-658:
----------------------------------

Our case is even simpler than the one you described:

>public class @Service MyBeanA extends BaseBean implements A ...
>public class @Service MyBeanB extends BaseBean implements B ...
>public class @Service @Alternative MyBeanBAlt extends BaseBean implements B ...

beanManager.getBeans(BaseBean.class, new ServiceQualifier()) should return MyBeanA and MyBeanBAlt

I understand that it is quite hard to define for which bean type filter criteria an alternative should be evaluated or not. For example:

>Example 1: beanManager.getBeans(Object.class)
>Example 2: beanManager.getBeans(BaseBean.class)
>Example 3: beanManager.getBeans(A.class)
>...

One solution could be to return all matching beans (inclusive alternatives) if the bean type filter criteria is not an interface (examples 1 and 2). For example 3, the alternatives for A are evaluated.


                
> BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans
> ----------------------------------------------------------------------------------
>
>                 Key: OWB-658
>                 URL: https://issues.apache.org/jira/browse/OWB-658
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Injection and Lookup
>    Affects Versions: 1.1.3
>            Reporter: Andreas Erne
>            Assignee: Mark Struberg
>             Fix For: 1.1.4
>
>
> Expected behaviour: beanManager.getBeans(Object.class, new ServiceQualifier()) finds all beans that are qualified as "Service", regardless of the beans implementation type
> Effective behaviour: The BeanManager fails if a base type (Object in this example) is provided instead of a leaf type. In theses cases, the BeanManager finds the Alternative beans only and forgets about all beans that lack of an Alternative
> Reason: The BeanManager's helper org.apache.webbeans.container.InjectionResolver fails in method implResolveByType method as it can not handle collections of beans of different types. It treats all beans as if they where of the same type (and therefore have the same Alternative)

--
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

        

[jira] [Updated] (OWB-658) BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans

Posted by "Mark Struberg (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OWB-658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Struberg updated OWB-658:
------------------------------

    Fix Version/s: 1.1.4
    
> BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans
> ----------------------------------------------------------------------------------
>
>                 Key: OWB-658
>                 URL: https://issues.apache.org/jira/browse/OWB-658
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Injection and Lookup
>    Affects Versions: 1.1.3
>            Reporter: Andreas Erne
>            Assignee: Mark Struberg
>             Fix For: 1.1.4
>
>
> Expected behaviour: beanManager.getBeans(Object.class, new ServiceQualifier()) finds all beans that are qualified as "Service", regardless of the beans implementation type
> Effective behaviour: The BeanManager fails if a base type (Object in this example) is provided instead of a leaf type. In theses cases, the BeanManager finds the Alternative beans only and forgets about all beans that lack of an Alternative
> Reason: The BeanManager's helper org.apache.webbeans.container.InjectionResolver fails in method implResolveByType method as it can not handle collections of beans of different types. It treats all beans as if they where of the same type (and therefore have the same Alternative)

--
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

        

[jira] [Assigned] (OWB-658) BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans

Posted by "Mark Struberg (Assigned) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OWB-658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Struberg reassigned OWB-658:
---------------------------------

    Assignee: Mark Struberg  (was: Gurkan Erdogdu)
    
> BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans
> ----------------------------------------------------------------------------------
>
>                 Key: OWB-658
>                 URL: https://issues.apache.org/jira/browse/OWB-658
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Injection and Lookup
>    Affects Versions: 1.1.3
>            Reporter: Andreas Erne
>            Assignee: Mark Struberg
>
> Expected behaviour: beanManager.getBeans(Object.class, new ServiceQualifier()) finds all beans that are qualified as "Service", regardless of the beans implementation type
> Effective behaviour: The BeanManager fails if a base type (Object in this example) is provided instead of a leaf type. In theses cases, the BeanManager finds the Alternative beans only and forgets about all beans that lack of an Alternative
> Reason: The BeanManager's helper org.apache.webbeans.container.InjectionResolver fails in method implResolveByType method as it can not handle collections of beans of different types. It treats all beans as if they where of the same type (and therefore have the same Alternative)

--
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

        

[jira] [Commented] (OWB-658) BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans

Posted by "Mark Struberg (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13241270#comment-13241270 ] 

Mark Struberg commented on OWB-658:
-----------------------------------

txs 4 the report! I'll dig into this in the next few days. In any case before our upcoming 1.1.4 release.
                
> BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans
> ----------------------------------------------------------------------------------
>
>                 Key: OWB-658
>                 URL: https://issues.apache.org/jira/browse/OWB-658
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Injection and Lookup
>    Affects Versions: 1.1.3
>            Reporter: Andreas Erne
>            Assignee: Mark Struberg
>
> Expected behaviour: beanManager.getBeans(Object.class, new ServiceQualifier()) finds all beans that are qualified as "Service", regardless of the beans implementation type
> Effective behaviour: The BeanManager fails if a base type (Object in this example) is provided instead of a leaf type. In theses cases, the BeanManager finds the Alternative beans only and forgets about all beans that lack of an Alternative
> Reason: The BeanManager's helper org.apache.webbeans.container.InjectionResolver fails in method implResolveByType method as it can not handle collections of beans of different types. It treats all beans as if they where of the same type (and therefore have the same Alternative)

--
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

        

[jira] [Commented] (OWB-658) BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans

Posted by "Mark Struberg (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13246260#comment-13246260 ] 

Mark Struberg commented on OWB-658:
-----------------------------------

Please put some ham in it. I need either a concrete example or a unit test which shows what is wrong.

The constellation you reported initially (query for Object.class + Classifier) works now, isn't?
If so then please create a follow up issue and set this one to resolved. 
The reason is that I like to start the 1.1.4 release tonight, and it is impossible to track those issues otherwise.
                
> BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans
> ----------------------------------------------------------------------------------
>
>                 Key: OWB-658
>                 URL: https://issues.apache.org/jira/browse/OWB-658
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Injection and Lookup
>    Affects Versions: 1.1.3
>            Reporter: Andreas Erne
>            Assignee: Mark Struberg
>             Fix For: 1.1.4
>
>
> Expected behaviour: beanManager.getBeans(Object.class, new ServiceQualifier()) finds all beans that are qualified as "Service", regardless of the beans implementation type
> Effective behaviour: The BeanManager fails if a base type (Object in this example) is provided instead of a leaf type. In theses cases, the BeanManager finds the Alternative beans only and forgets about all beans that lack of an Alternative
> Reason: The BeanManager's helper org.apache.webbeans.container.InjectionResolver fails in method implResolveByType method as it can not handle collections of beans of different types. It treats all beans as if they where of the same type (and therefore have the same Alternative)

--
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

        

[jira] [Resolved] (OWB-658) BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans

Posted by "Mark Struberg (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OWB-658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Struberg resolved OWB-658.
-------------------------------

    Resolution: Fixed

oki, back from talking with Pete. 5.1 defines 'available for injection' and 11.3.4 specifies that getBeans() only returns beans which are available for injection.

getBeans(TypeX) only resolves beans which are enabled for filling an InjetionPoint of TypeX!

                
> BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans
> ----------------------------------------------------------------------------------
>
>                 Key: OWB-658
>                 URL: https://issues.apache.org/jira/browse/OWB-658
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Injection and Lookup
>    Affects Versions: 1.1.3
>            Reporter: Andreas Erne
>            Assignee: Mark Struberg
>             Fix For: 1.1.4
>
>
> Expected behaviour: beanManager.getBeans(Object.class, new ServiceQualifier()) finds all beans that are qualified as "Service", regardless of the beans implementation type
> Effective behaviour: The BeanManager fails if a base type (Object in this example) is provided instead of a leaf type. In theses cases, the BeanManager finds the Alternative beans only and forgets about all beans that lack of an Alternative
> Reason: The BeanManager's helper org.apache.webbeans.container.InjectionResolver fails in method implResolveByType method as it can not handle collections of beans of different types. It treats all beans as if they where of the same type (and therefore have the same Alternative)

--
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

        

[jira] [Commented] (OWB-658) BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans

Posted by "Mark Struberg (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OWB-658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13246286#comment-13246286 ] 

Mark Struberg commented on OWB-658:
-----------------------------------

> beanManager.getBeans(BaseBean.class, new ServiceQualifier()) should return MyBeanA and MyBeanBAlt 
nope, because MyBeanBAlt is also an @Alternative for MyBeanA. (because of the extends BaseBean).

MyBeanBAlt + MyBeanA would only be returned if MyBeanBAlt would NOT extend BaseBean.

And yes, filter criterias are a region where we certainly need to take care off in the spec. I'm also not 100% sure if BeanManager#getBeans() or BeanManager#resolve() should perform this part of the filtering. I'll discuss this with the colleagues in the EG.


                
> BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans
> ----------------------------------------------------------------------------------
>
>                 Key: OWB-658
>                 URL: https://issues.apache.org/jira/browse/OWB-658
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Injection and Lookup
>    Affects Versions: 1.1.3
>            Reporter: Andreas Erne
>            Assignee: Mark Struberg
>             Fix For: 1.1.4
>
>
> Expected behaviour: beanManager.getBeans(Object.class, new ServiceQualifier()) finds all beans that are qualified as "Service", regardless of the beans implementation type
> Effective behaviour: The BeanManager fails if a base type (Object in this example) is provided instead of a leaf type. In theses cases, the BeanManager finds the Alternative beans only and forgets about all beans that lack of an Alternative
> Reason: The BeanManager's helper org.apache.webbeans.container.InjectionResolver fails in method implResolveByType method as it can not handle collections of beans of different types. It treats all beans as if they where of the same type (and therefore have the same Alternative)

--
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

        

[jira] [Resolved] (OWB-658) BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans

Posted by "Mark Struberg (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OWB-658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Struberg resolved OWB-658.
-------------------------------

    Resolution: Fixed

can you please try with the latest SNAPSHOT? The behaviour is not yet final as we need to specify the correct behaviour in the EG first.
                
> BeanManager.getBeans(Type, Annotation...) can not be used to query all known beans
> ----------------------------------------------------------------------------------
>
>                 Key: OWB-658
>                 URL: https://issues.apache.org/jira/browse/OWB-658
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Injection and Lookup
>    Affects Versions: 1.1.3
>            Reporter: Andreas Erne
>            Assignee: Mark Struberg
>             Fix For: 1.1.4
>
>
> Expected behaviour: beanManager.getBeans(Object.class, new ServiceQualifier()) finds all beans that are qualified as "Service", regardless of the beans implementation type
> Effective behaviour: The BeanManager fails if a base type (Object in this example) is provided instead of a leaf type. In theses cases, the BeanManager finds the Alternative beans only and forgets about all beans that lack of an Alternative
> Reason: The BeanManager's helper org.apache.webbeans.container.InjectionResolver fails in method implResolveByType method as it can not handle collections of beans of different types. It treats all beans as if they where of the same type (and therefore have the same Alternative)

--
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