[jbosstools-issues] [JBoss JIRA] Commented: (JBIDE-9313) Resolution of injected beans should consider only beans eligible for injection.

Pete Muir (JIRA) jira-events at lists.jboss.org
Mon Jul 11 12:40:23 EDT 2011


    [ https://issues.jboss.org/browse/JBIDE-9313?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12613516#comment-12613516 ] 

Pete Muir commented on JBIDE-9313:
----------------------------------

All your assertions seem correct to me. Is there a problem?

> Resolution of injected beans should consider only beans eligible for injection.
> -------------------------------------------------------------------------------
>
>                 Key: JBIDE-9313
>                 URL: https://issues.jboss.org/browse/JBIDE-9313
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: cdi (jsr-299)
>    Affects Versions: 3.3.0.M2
>            Reporter: Viacheslav Kabanovich
>            Assignee: Viacheslav Kabanovich
>             Fix For: 3.3.0.M3
>
>
> JSR-299:
> {code}
> 5.2. Typesafe resolution
> A bean is *eligible* for injection to a certain injection point if:
> • it is *available* for injection in the module that contains the class that declares the injection point, and
> • it is assignable to the injection point
> 5.1.4. Inter-module injection
> A bean is *available* for injection in a certain module if:
> • the bean is not an interceptor or decorator,
> • the bean is enabled,
> • the bean is either not an alternative, or the module is a bean archive and the bean is a selected alternative of the bean
>    archive, and
> • the bean class is required to be accessible to classes in the module, according to the class accessibility requirements of
>    the module architecture.
> 2.6. Alternatives
> An alternative is a bean that must be explicitly declared in the beans.xml file if it should be *available* for lookup, injection or EL resolution.
> 5.1.2. Enabled and disabled beans
> A bean is said to be enabled if:
> • it is deployed in a bean archive, and
> • it is not a producer method or field of a disabled bean, and
> • it is not specialized by any other enabled bean, as defined in Section 4.3, "Specialization", and either
> • it is not an alternative, or it is a selected alternative of at least one bean archive.
> {code}
> That means, that before we resolve ambiguousness, we have to remove from the set of beans, collected by matching type and qualifiers, all unavailable beans:
> (a) decorators and interceptors;
> (b) beans specialized by enabled beans;
> (c) alternatives, not selected in the bean archive that contains the class that declares the injection point;
> (d) producers declared in alternatives, not selected in at least one bean archive.
> For (a) we have a validation rule that warns if an injection is resolved to a decorator; to preserve it, we will have to make sure that injection is both unsatisfied and a decorator is matching it by type and qualifiers. However, now also validation is incorrectly warns about 'multiple beans' if there is one eligible bean plus one matching decorator. Since decorator is never eligible for injection, maybe that warning may be dropped and replaced by 'no eligible bean' in this case.
> In the same way, for (b), now validation incorrectly warns about 'multiple beans' if there is eligible specialized bean and its super class matches the injection; though super class bean is disabled and therefore is not eligible for injection.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the jbosstools-issues mailing list