<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Emily,</p>
<p><br>
</p>
<p>Just want to make sure I follow. Are you saying this because right now it is required that you add @Produces to the overridden method?</p>
<p><br>
</p>
<p>I don't realistically see a scenario where you would override the method and not add produces. This method is intended to be called by the container.</p>
<p><br>
</p>
<p>John</p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Emily Jiang <EMIJIANG@uk.ibm.com><br>
<b>Sent:</b> Tuesday, September 13, 2016 4:37 AM<br>
<b>To:</b> John Ament<br>
<b>Cc:</b> Matej Novotny; Mark Struberg; cdi-dev<br>
<b>Subject:</b> Re: [cdi-dev] Should javax.enterprise.inject.Produces be inherited?</font>
<div> </div>
</div>
<div><font size="2" face="sans-serif">First of all, the subject line suggests the produces should be inherited under all conditions. Anyway, after your explanation, I think this suggestion contradicts with spec and breaks backward compatibility. In the cdi
1.2/cdi 2.0 spec,</font> <br>
<br>
<br>
<font size="3">The only way one bean can completely override a second bean at all injection points is if it implements all the bean types and declares all the qualifiers of the second bean.
<b>However, if the second bean declares a producer method or observer method, then even this is not enough to ensure that the second bean is never called!</b></font>
<p><font size="3">To help prevent developer error, the first bean may:</font> </p>
<ul>
<li><font size="3">directly extend the bean class of the second bean, or</font> </li><li><font size="3"><b>directly override the producer method, in the case that the second bean is a producer method, and then</b></font></li></ul>
<font size="3">explicitly declare that it <i>specializes</i> the second bean.</font>
<p></p>
<p><font size="2" face="sans-serif">After this suggestion, the above sentence is not true any more.</font>
<br>
<br>
<font size="2" face="sans-serif">Many thanks,<br>
Emily<br>
===========================<br>
Emily Jiang<br>
WebSphere Application Server, CDI Development Lead</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">John Ament <john.ament@spartasystems.com></font>
<br>
<font size="1" color="#5f5f5f" face="sans-serif">To: </font><font size="1" face="sans-serif">Matej Novotny <manovotn@redhat.com>, Mark Struberg <struberg@yahoo.de></font>
<br>
<font size="1" color="#5f5f5f" face="sans-serif">Cc: </font><font size="1" face="sans-serif">Emily Jiang/UK/IBM@IBMGB, cdi-dev <cdi-dev@lists.jboss.org></font>
<br>
<font size="1" color="#5f5f5f" face="sans-serif">Date: </font><font size="1" face="sans-serif">12/09/2016 13:31</font>
<br>
<font size="1" color="#5f5f5f" face="sans-serif">Subject: </font><font size="1" face="sans-serif">Re: [cdi-dev] Should javax.enterprise.inject.Produces be inherited?</font>
<br>
<font size="1" color="#5f5f5f" face="sans-serif">Sent by: </font><font size="1" face="sans-serif">cdi-dev-bounces@lists.jboss.org</font>
<br>
</p>
<hr noshade="">
<br>
<br>
<br>
<font size="3" face="Calibri">@Matej - Yes, that would be consistent with what I was seeing as well.</font>
<br>
<br>
<font size="3" face="Calibri">@Mark - Are you thinking about decorators and not alternatives? See also [1]</font>
<br>
<font size="3" face="Calibri">Really the goal here is to substitute the bean, but not just the provided bean the producer method that it exposes. It seems to work as I would expect it in weld (as mentioned), when I add @Produces to the method, it overrides
the base class's producer method. No ambiguous resolutions, it just works properly.</font>
<br>
<br>
<font size="3" face="Calibri">Realistically, this is all an experiment to see if I can provide spring boot like default configurations (beans, config values, etc) in a framework, and override them as an application developer.</font>
<br>
<br>
<br>
<font size="3" face="Calibri">[1]: </font><a href="http://docs.jboss.org/cdi/spec/2.0.EDR2/cdi-spec.html#alternatives" id="LPlnk118811"><font size="3" color="blue" face="Calibri"><u>http://docs.jboss.org/cdi/spec/2.0.EDR2/cdi-spec.html#alternatives</u></font></a>
<p><font size="3" face="Calibri"><br>
</font><br>
</p>
<hr>
<br>
<font size="2" face="Calibri"><b>From:</b> Matej Novotny <manovotn@redhat.com><b><br>
Sent:</b> Monday, September 12, 2016 3:28 AM<b><br>
To:</b> Mark Struberg<b><br>
Cc:</b> John Ament; Emily Jiang; cdi-dev<b><br>
Subject:</b> Re: [cdi-dev] Should javax.enterprise.inject.Produces be inherited?</font><font size="3" face="Calibri">
</font><br>
<font size="3" face="Calibri"> </font> <br>
<font size="2" face="Calibri">Hi all,<br>
<br>
I did some testing (with Weld) and it seems the scope IS inherited when you use @Alternative.<br>
However it IS NOT inherited when you use @Specialized.<br>
<br>
Not yet sure if this is intended or anyhow spec-defined, just stating facts.<br>
<br>
Matej<br>
<br>
----- Original Message -----<br>
> From: "Mark Struberg" <struberg@yahoo.de><br>
> To: "John Ament" <john.ament@spartasystems.com>, "Emily Jiang" <EMIJIANG@uk.ibm.com><br>
> Cc: "cdi-dev" <cdi-dev@lists.jboss.org><br>
> Sent: Monday, September 12, 2016 8:00:55 AM<br>
> Subject: Re: [cdi-dev] Should javax.enterprise.inject.Produces be inherited?<br>
> <br>
> <br>
> <br>
> > Right now inheritance of managed beans is itself problematic, as<br>
> <br>
> > injecting the base class can cause these ambiguous resolutions.<br>
> <br>
> Yes, that's why we originally introduced @Typed.<br>
> <br>
> <br>
> <br>
> Your sample wont work as an Alternative as it extends a concrete class and<br>
> doesn't implement any interface.<br>
> Did you mean @Specializes?<br>
> Note that with @Alternative you won't make the original producer go away.You<br>
> would also need to add @Alternative to the producer method imo. The rules<br>
> for making an alternative producer method are really a bit confusing ;) I<br>
> think the most portable way is to annotate both the class and the producer<br>
> method with @Alternative.<br>
> <br>
> <br>
> LieGrue,<br>
> strub<br>
> <br>
> <br>
> On Monday, 12 September 2016, 0:57, John Ament <john.ament@spartasystems.com><br>
> wrote:<br>
> ><br>
> >Hi Emily,<br>
> ><br>
> ><br>
> >I disagree, at least it doesn't add any new ambiguous injections. The<br>
> >use-case is specifically to Specialized/Alternative beans. Right now<br>
> >inheritance of managed beans is itself problematic, as injecting the base<br>
> >class can cause these ambiguous resolutions.<br>
> ><br>
> ><br>
> >The example I sent out actually works correctly (in weld at least), really<br>
> >my propose is to remove the need to have Produces a second time and update<br>
> >the spec to clarify what happens here (FWIW, I don't believe the case is<br>
> >currently described in the spec), hopefully to say that qualifiers and<br>
> >scopes from the base method remain in effect, unless explicitly overridden.<br>
> ><br>
> ><br>
> >John<br>
> ><br>
> ><br>
> ><br>
> >________________________________<br>
> > <br>
> >From: Emily Jiang <EMIJIANG@uk.ibm.com><br>
> >Sent: Sunday, September 11, 2016 5:59 PM<br>
> >To: John Ament<br>
> >Cc: cdi-dev<br>
> >Subject: Re: [cdi-dev] Should javax.enterprise.inject.Produces be inherited?<br>
> > <br>
> >I think this is very problematic as you will get<br>
> >AmbiguousResolutionException all the time once we introduce this<br>
> >inheritance.<br>
> ><br>
> >Many thanks,<br>
> >Emily<br>
> >===========================<br>
> >Emily Jiang<br>
> >WebSphere Application Server, CDI Development Lead<br>
> > <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>
> ><br>
> ><br>
> ><br>
> ><br>
> >From: John Ament <john.ament@spartasystems.com><br>
> >To: cdi-dev <cdi-dev@lists.jboss.org><br>
> >Date: 11/09/2016 20:04<br>
> >Subject: [cdi-dev] Should javax.enterprise.inject.Produces be<br>
> >inherited?<br>
> >Sent by: cdi-dev-bounces@lists.jboss.org<br>
> >>________________________________<br>
> > <br>
> ><br>
> ><br>
> >All,<br>
> ><br>
> >I was just thinking about alternatives and producer methods. Suppose I have<br>
> >the following bean:<br>
> ><br>
> >@ApplicationScoped<br>
> >public class Boop {<br>
> ><br>
> > @Produces<br>
> > @ApplicationScoped<br>
> > public Simpler makeSimpler() {<br>
> > return new Simpler("Boop");<br>
> > }<br>
> >}<br>
> ><br>
> >If I want to override the producer method, I need to declare fully:<br>
> ><br>
> >@Alternative<br>
> >@Priority(100)<br>
> >@ApplicationScoped<br>
> >public class BoopAlternative extends Boop{<br>
> > @Override<br>
> > @Produces<br>
> > public Simpler makeSimpler() {<br>
> > return new Simpler("Boop2");<br>
> > }<br>
> >}<br>
> ><br>
> >For some reason, scopes are inherited, but the produces annotation is not.<br>
> >At least in the case of a producer method, it seems like it would be<br>
> >useful for @Produces to be inherited as well.<br>
> ><br>
> >John<br>
> ><br>
> >________________________________<br>
> > NOTICE: This e-mail message and any attachments may contain confidential,<br>
> > proprietary, and/or privileged information which should be treated<br>
> > accordingly. If you are not the intended recipient, please notify the<br>
> > sender immediately by return e-mail, delete this message, and destroy all<br>
> > physical and electronic copies. Thank you.<br>
> > _______________________________________________<br>
> >cdi-dev mailing list<br>
> >cdi-dev@lists.jboss.org<br>
> ></font><a href="https://lists.jboss.org/mailman/listinfo/cdi-dev"><font size="2" color="blue" face="Calibri"><u>https://lists.jboss.org/mailman/listinfo/cdi-dev</u></font></a><font size="2" face="Calibri">
</font>
<table width="100%" style="border-collapse:collapse">
<tbody>
<tr valign="top" height="8">
<td width="100%" bgcolor="white" style="border-style:solid none solid none; border-color:#C8C8C8; border-width:1px 0px 1px 0px; padding:1px 1px">
<a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" target="_blank"><font size="3" color="blue" face="Segoe UI Light">cdi-dev Info Page - JBoss Developer</font></a>
<br>
<font size="1" color="#5f5f5f" face="Segoe UI">lists.jboss.org</font> <br>
<font size="1" color="#5f5f5f" face="Segoe UI">List to discuss the development of CDI (the specification) To see the collection of prior postings to the list, visit the cdi-dev Archives.</font></td>
</tr>
</tbody>
</table>
<br>
<font size="2" face="Calibri"><br>
<br>
> ><br>
> >Note that for all code provided on this list, the provider licenses the code<br>
> >under the Apache License, Version 2<br>
> >(</font><a href="http://www.apache.org/licenses/LICENSE-2.0.html"><font size="2" color="blue" face="Calibri"><u>http://www.apache.org/licenses/LICENSE-2.0.html</u></font></a><font size="2" face="Calibri">). For all other ideas<br>
> >provided on this list, the provider waives all patent and other<br>
> >intellectual property rights inherent in such information.<br>
> >cdi-dev Info Page - JBoss Developer<br>
> >lists.jboss.org<br>
> >List to discuss the development of CDI (the specification) To see the<br>
> >collection of prior postings to the list, visit the cdi-dev Archives.<br>
> ><br>
> ><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>
> ><br>
> >________________________________<br>
> > NOTICE: This e-mail message and any attachments may contain confidential,<br>
> > proprietary, and/or privileged information which should be treated<br>
> > accordingly. If you are not the intended recipient, please notify the<br>
> > sender immediately by return e-mail, delete this message, and destroy all<br>
> > physical and electronic copies. Thank you.<br>
> ><br>
> >_______________________________________________<br>
> >cdi-dev mailing list<br>
> >cdi-dev@lists.jboss.org<br>
> ></font><a href="https://lists.jboss.org/mailman/listinfo/cdi-dev"><font size="2" color="blue" face="Calibri"><u>https://lists.jboss.org/mailman/listinfo/cdi-dev</u></font></a><font size="2" face="Calibri"><br>
> ><br>
> >Note that for all code provided on this list, the provider licenses the code<br>
> >under the Apache License, Version 2<br>
> >(</font><a href="http://www.apache.org/licenses/LICENSE-2.0.html"><font size="2" color="blue" face="Calibri"><u>http://www.apache.org/licenses/LICENSE-2.0.html</u></font></a><font size="2" face="Calibri">). For all other ideas<br>
> >provided on this list, the provider waives all patent and other<br>
> >intellectual property rights inherent in such information.<br>
> ><br>
> ><br>
> _______________________________________________<br>
> cdi-dev mailing list<br>
> cdi-dev@lists.jboss.org<br>
> </font><a href="https://lists.jboss.org/mailman/listinfo/cdi-dev"><font size="2" color="blue" face="Calibri"><u>https://lists.jboss.org/mailman/listinfo/cdi-dev</u></font></a><font size="2" face="Calibri"><br>
> <br>
> Note that for all code provided on this list, the provider licenses the code<br>
> under the Apache License, Version 2<br>
> (</font><a href="http://www.apache.org/licenses/LICENSE-2.0.html"><font size="2" color="blue" face="Calibri"><u>http://www.apache.org/licenses/LICENSE-2.0.html</u></font></a><font size="2" face="Calibri">). For all other ideas<br>
> provided on this list, the provider waives all patent and other intellectual<br>
> property rights inherent in such information.<br>
> </font><br>
<hr>
<font size="3">NOTICE: This e-mail message and any attachments may contain confidential, proprietary, and/or privileged information which should be treated accordingly. If you are not the intended recipient, please notify the sender immediately by return e-mail,
delete this message, and destroy all physical and electronic copies. Thank you. </font>
<tt><font size="2">_______________________________________________<br>
cdi-dev mailing list<br>
cdi-dev@lists.jboss.org<br>
</font></tt><a href="https://lists.jboss.org/mailman/listinfo/cdi-dev"><tt><font size="2">https://lists.jboss.org/mailman/listinfo/cdi-dev</font></tt></a><tt><font size="2"><br>
<br>
Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (</font></tt><a href="http://www.apache.org/licenses/LICENSE-2.0.html"><tt><font size="2">http://www.apache.org/licenses/LICENSE-2.0.html</font></tt></a><tt><font size="2">).
For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.</font></tt>
<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></div>
</div>
</div>
<hr>
NOTICE: This e-mail message and any attachments may contain confidential, proprietary, and/or privileged information which should be treated accordingly. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this
message, and destroy all physical and electronic copies. Thank you.
</body>
</html>