<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">&nbsp;<br>
MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN<br>
Phone: &nbsp;+44 (0)1962 816278 &nbsp;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: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">Matej Novotny &lt;manovotn@redhat.com&gt;</font>
<br><font size=1 color=#5f5f5f face="sans-serif">To: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">Benjamin Confino &lt;BENJAMIC@uk.ibm.com&gt;</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Cc: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">weld-dev@lists.jboss.org,
Emily Jiang &lt;EMIJIANG@uk.ibm.com&gt;</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Date: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">24/08/2018 16:17</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Subject: &nbsp; &nbsp;
&nbsp; &nbsp;</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 &quot;according to the rules for candidates of typesafe
resolution defined in Performing typesafe resolution.&quot;.<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>
&gt; From: &quot;Benjamin Confino&quot; &lt;BENJAMIC@uk.ibm.com&gt;<br>
&gt; To: weld-dev@lists.jboss.org<br>
&gt; Cc: &quot;Emily Jiang&quot; &lt;EMIJIANG@uk.ibm.com&gt;<br>
&gt; Sent: Friday, August 24, 2018 3:10:05 PM<br>
&gt; Subject: [weld-dev] Question about the spec for BeanManager.getBeans<br>
&gt; <br>
&gt; Hello<br>
&gt; <br>
&gt; I was made aware of the difference on the return of<br>
&gt; beanManager.getBeans(Object.class) between OWB and Weld<br>
&gt; <br>
&gt; In OWB, it returns all beans, unless there is an enabled @alternative
within<br>
&gt; the application. If there is an enabled @alternative getBeans() only
returns<br>
&gt; beans annotated @alternative.<br>
&gt; <br>
&gt; However, in Weld, it returns all beans even with an enabled @alternative.<br>
&gt; <br>
&gt; The JavaDoc for BeanMnanager says &quot;according to the rules of
typesafe<br>
&gt; resolution&quot; and in the CDI 1.0 spec under typesafe resolution
I find one<br>
&gt; mention of alternatives: “When an ambiguous dependency exists, the
container<br>
&gt; attempts to resolve the ambiguity. The container eliminates all eligible<br>
&gt; beans that are not alternatives, except for producer methods and fields
of<br>
&gt; beans that are alternatives.” (This text is also in the CDI 1.2 spec)<br>
&gt; <br>
&gt; However this would imply that if there are no enabled @Alternatives
an<br>
&gt; ambiguous resolution like beanManager.getBeans(Object.class) should
discard<br>
&gt; everything. In this case, the Weld behaviour is incorrect.<br>
&gt; beanManager.getBeans() should only return the resolved or enabled
beans.<br>
&gt; <br>
&gt; Regards<br>
&gt; Benjamin<br>
&gt; <br>
&gt; Can someone verify this?<br>
&gt; Unless stated otherwise above:<br>
&gt; IBM United Kingdom Limited - Registered in England and Wales with
number<br>
&gt; 741598.<br>
&gt; Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire
PO6 3AU<br>
&gt; <br>
&gt; _______________________________________________<br>
&gt; weld-dev mailing list<br>
&gt; weld-dev@lists.jboss.org<br>
&gt; </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>