<font size=2 face="sans-serif">Matej,</font>
<br>
<br><font size=2 face="sans-serif">Thanks for your quick reply!</font>
<br><font size=2 face="sans-serif">I think the spec is quite clear by saying
the candidates of typesafe resolutions defined in Performing typesafe resolutions...
surely a disabled bean cannot be a candidate. it is simply disquailified.
</font>
<br>
<br><font size=2 face="sans-serif">It did not say eliminate all beans but
one though. I think it should be eliminate disqualified ones and leave
all qualified at least. </font>
<br>
<br><font size=2 face="sans-serif">I am sending to cdi-dev for clarification.
Antoine, please comment.</font>
<br>
<br><font size=2 face="sans-serif">Many thanks,<br>
Emily<br>
===========================<br>
Emily Jiang<br>
WebSphere Application Server, Liberty Architect for MicroProfile and CDI</font>
<br><font size=2 face="sans-serif"> <br>
MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN<br>
Phone: +44 (0)1962 816278 Internal: 246278<br>
<br>
Email: emijiang@uk.ibm.com <br>
Lotus Notes: Emily Jiang/UK/IBM@IBMGB<br>
</font>
<br>
<br>
<br>
<br><font size=1 color=#5f5f5f face="sans-serif">From:
</font><font size=1 face="sans-serif">Matej Novotny <manovotn@redhat.com></font>
<br><font size=1 color=#5f5f5f face="sans-serif">To:
</font><font size=1 face="sans-serif">Benjamin Confino <BENJAMIC@uk.ibm.com></font>
<br><font size=1 color=#5f5f5f face="sans-serif">Cc:
</font><font size=1 face="sans-serif">weld-dev@lists.jboss.org,
Emily Jiang <EMIJIANG@uk.ibm.com></font>
<br><font size=1 color=#5f5f5f face="sans-serif">Date:
</font><font size=1 face="sans-serif">24/08/2018 16:17</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Subject:
</font><font size=1 face="sans-serif">Re: [weld-dev]
Question about the spec for BeanManager.getBeans</font>
<br>
<hr noshade>
<br>
<br>
<br><tt><font size=2>Hi<br>
<br>
Looking at spec 11.3.6. Obtaining a Bean by type[1] I can see that the
paragraph ends with "according to the rules for candidates of typesafe
resolution defined in Performing typesafe resolution.".<br>
The important word here is *candidates* IMO. <br>
The way typesafe resolution is defined, both the original bean and the
alternatives are candidates. According to spec, the original bean is still
considered enabled[2]<br>
Note that CDI spec doesn't say that @Alternative would completely eliminate
the original bean, it just takes precedence during resolution (as opposed
to what specialization does[3]).<br>
<br>
Last but not least, one thought - if the getBeans() method was to perform
a typesafe resolution and eliminate all but one bean - why would it return
a Set (and not throw unsatisfied/ambiguous exceptions)? :)<br>
<br>
Matej<br>
______________________________________________________________________________<br>
[1] </font></tt><a href="http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#bm_obtain_bean_by_type"><tt><font size=2>http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#bm_obtain_bean_by_type</font></tt></a><tt><font size=2><br>
[2] </font></tt><a href="http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#enablement"><tt><font size=2>http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#enablement</font></tt></a><tt><font size=2><br>
[3] </font></tt><a href="http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#specialization"><tt><font size=2>http://docs.jboss.org/cdi/spec/1.2/cdi-spec.html#specialization</font></tt></a><tt><font size=2><br>
<br>
<br>
----- Original Message -----<br>
> From: "Benjamin Confino" <BENJAMIC@uk.ibm.com><br>
> To: weld-dev@lists.jboss.org<br>
> Cc: "Emily Jiang" <EMIJIANG@uk.ibm.com><br>
> Sent: Friday, August 24, 2018 3:10:05 PM<br>
> Subject: [weld-dev] Question about the spec for BeanManager.getBeans<br>
> <br>
> Hello<br>
> <br>
> I was made aware of the difference on the return of<br>
> beanManager.getBeans(Object.class) between OWB and Weld<br>
> <br>
> In OWB, it returns all beans, unless there is an enabled @alternative
within<br>
> the application. If there is an enabled @alternative getBeans() only
returns<br>
> beans annotated @alternative.<br>
> <br>
> However, in Weld, it returns all beans even with an enabled @alternative.<br>
> <br>
> The JavaDoc for BeanMnanager says "according to the rules of
typesafe<br>
> resolution" and in the CDI 1.0 spec under typesafe resolution
I find one<br>
> mention of alternatives: “When an ambiguous dependency exists, the
container<br>
> attempts to resolve the ambiguity. The container eliminates all eligible<br>
> beans that are not alternatives, except for producer methods and fields
of<br>
> beans that are alternatives.” (This text is also in the CDI 1.2 spec)<br>
> <br>
> However this would imply that if there are no enabled @Alternatives
an<br>
> ambiguous resolution like beanManager.getBeans(Object.class) should
discard<br>
> everything. In this case, the Weld behaviour is incorrect.<br>
> beanManager.getBeans() should only return the resolved or enabled
beans.<br>
> <br>
> Regards<br>
> Benjamin<br>
> <br>
> Can someone verify this?<br>
> Unless stated otherwise above:<br>
> IBM United Kingdom Limited - Registered in England and Wales with
number<br>
> 741598.<br>
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire
PO6 3AU<br>
> <br>
> _______________________________________________<br>
> weld-dev mailing list<br>
> weld-dev@lists.jboss.org<br>
> </font></tt><a href="https://lists.jboss.org/mailman/listinfo/weld-dev"><tt><font size=2>https://lists.jboss.org/mailman/listinfo/weld-dev</font></tt></a><tt><font size=2><br>
<br>
</font></tt>
<br>
<br><font size=2 face="sans-serif"><br>
Unless stated otherwise above:<br>
IBM United Kingdom Limited - Registered in England and Wales with number
741598. <br>
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
3AU<br>
</font>