<html><body>
<p><font size="2" face="sans-serif">FWIW I agree with Mark & Stu, but isn't backwards compatibility a concern here for implementations that previously supported subclassing?</font><br>
<ul style="padding-left: 0pt"><font size="2" face="sans-serif">Sincerely,<br>
<br>
Joe<br>
</font></ul>
<br>
<img width="16" height="16" src="cid:1__=0ABBF0EEDFD912098f9e8a93df938@us.ibm.com" border="0" alt="Inactive hide details for Pete Muir ---09/18/2012 05:01:07 AM---I'm happy to go with whatever you guys agree on here :-) Marius"><font size="2" color="#424282" face="sans-serif">Pete Muir ---09/18/2012 05:01:07 AM---I'm happy to go with whatever you guys agree on here :-) Marius, I guess you are the only dissenter</font><br>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBF0EEDFD912098f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<ul style="padding-left: 4pt"><font size="1" color="#5F5F5F" face="sans-serif">From:</font></ul>
</td><td width="100%"><img width="1" height="1" src="cid:2__=0ABBF0EEDFD912098f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<font size="1" face="sans-serif">Pete Muir <pmuir@redhat.com></font></td></tr>
<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBF0EEDFD912098f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<ul style="padding-left: 4pt"><font size="1" color="#5F5F5F" face="sans-serif">To:</font></ul>
</td><td width="100%"><img width="1" height="1" src="cid:2__=0ABBF0EEDFD912098f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<font size="1" face="sans-serif">Mark Struberg <struberg@yahoo.de>, </font></td></tr>
<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBF0EEDFD912098f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<ul style="padding-left: 4pt"><font size="1" color="#5F5F5F" face="sans-serif">Cc:</font></ul>
</td><td width="100%" valign="middle"><img width="1" height="1" src="cid:2__=0ABBF0EEDFD912098f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<font size="1" face="sans-serif">"cdi-dev@lists.jboss.org" <cdi-dev@lists.jboss.org></font></td></tr>
<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBF0EEDFD912098f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<ul style="padding-left: 4pt"><font size="1" color="#5F5F5F" face="sans-serif">Date:</font></ul>
</td><td width="100%"><img width="1" height="1" src="cid:2__=0ABBF0EEDFD912098f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<font size="1" face="sans-serif">09/18/2012 05:01 AM</font></td></tr>
<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBF0EEDFD912098f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<ul style="padding-left: 4pt"><font size="1" color="#5F5F5F" face="sans-serif">Subject:</font></ul>
</td><td width="100%"><img width="1" height="1" src="cid:2__=0ABBF0EEDFD912098f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<font size="1" face="sans-serif">Re: [cdi-dev] Subclassing?</font></td></tr>
<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:2__=0ABBF0EEDFD912098f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<ul style="padding-left: 4pt"><font size="1" color="#5F5F5F" face="sans-serif">Sent by:</font></ul>
</td><td width="100%"><img width="1" height="1" src="cid:2__=0ABBF0EEDFD912098f9e8a93df938@us.ibm.com" border="0" alt=""><br>
<font size="1" face="sans-serif">cdi-dev-bounces@lists.jboss.org</font></td></tr>
</table>
<hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br>
<br>
<br>
<tt><font size="2">I'm happy to go with whatever you guys agree on here :-)<br>
<br>
Marius, I guess you are the only dissenter now :-) WDYT?<br>
<br>
On 18 Sep 2012, at 07:46, Mark Struberg wrote:<br>
<br>
> Hi Stu!<br>
> <br>
> +1, fully agree.<br>
> <br>
> <br>
> LieGrue,<br>
> strub<br>
> <br>
> <br>
> <br>
> ----- Original Message -----<br>
>> From: Stuart Douglas <stuart.w.douglas@gmail.com><br>
>> To: Mark Struberg <struberg@yahoo.de><br>
>> Cc: Pete Muir <pmuir@redhat.com>; Romain Manni-Bucau <rmannibucau@gmail.com>; "cdi-dev@lists.jboss.org" <cdi-dev@lists.jboss.org><br>
>> Sent: Tuesday, September 18, 2012 12:22 AM<br>
>> Subject: Re: [cdi-dev] Subclassing?<br>
>> <br>
>> <br>
>> <br>
>> Mark Struberg wrote:<br>
>>> Not sure if the trick with the ThreadLocal would work (aside from being dog <br>
>> slow).<br>
>>> A->B->A should all lead to decorator invocations. Is this the case <br>
>> with your impl? (B might be another Decorator or a simple Bean)<br>
>> <br>
>> Depends if B is a normal scoped bean or not. I agree this is not ideal.<br>
>> <br>
>> To be honest I think it may actually be better to tighten the <br>
>> requirements for intercepted/decorated beans to allow interception to be <br>
>> implemented via a proxy. The way the CDI 1.0 spec was written this was <br>
>> not really possible to do and still be spec compliant (although the TCK <br>
>> did not test this), but we could change to 1.1 spec to require all <br>
>> intercepted classes to meet the proxiability requirements.<br>
>> <br>
>> Basically as I see it the pros/cons of each are:<br>
>> <br>
>> Subclassing:<br>
>> <br>
>> Pros:<br>
>> 1. Can use reflection to read fields / bean can have public fields<br>
>> 2. No proxiability requirement<br>
>> 3. Constructor is only called once<br>
>> <br>
>> Cons:<br>
>> 4. Self invocation cannot be handled consistently<br>
>> 5. Implementation is more complex<br>
>> 6. For normal scoped beans the bean has to be proxied anyway, so there <br>
>> is no advantage<br>
>> <br>
>> <br>
>> Proxying:<br>
>> <br>
>> Pros:<br>
>> 7. Consistent with all other interceptor behavior<br>
>> 8. Self invocation works as expected<br>
>> <br>
>> Cons:<br>
>> 9. Bean must meet proxiability requirements (although you can get around <br>
>> this with JVM specific hacks)<br>
>> 10. Constructor will be called twice<br>
>> <br>
>> I do not consider 1. to be worth considering as a real advantage (public <br>
>> fields == yuck). Basically the only advantage that sub classing has is <br>
>> when you are dealing with a dependent scoped bean that would not meet <br>
>> the proxyability requirements. I think in this case adding a default <br>
>> constructor to enable the bean to be proxied is not a big deal.<br>
>> <br>
>> Stuart<br>
>> <br>
>> <br>
>>> <br>
>>> LieGrue,<br>
>>> strub<br>
>>> <br>
>>> <br>
>>> <br>
>>> <br>
>>> ----- Original Message -----<br>
>>>> From: Stuart Douglas<stuart.w.douglas@gmail.com><br>
>>>> To: Mark Struberg<struberg@yahoo.de><br>
>>>> Cc: Pete Muir<pmuir@redhat.com>; Romain <br>
>> Manni-Bucau<rmannibucau@gmail.com>; <br>
>> "cdi-dev@lists.jboss.org"<cdi-dev@lists.jboss.org><br>
>>>> Sent: Monday, September 17, 2012 11:31 PM<br>
>>>> Subject: Re: [cdi-dev] Subclassing?<br>
>>>> <br>
>>>> <br>
>>>> <br>
>>>> Mark Struberg wrote:<br>
>>>>> The main difference we get from subclassing is that even <br>
>> 'internal<br>
>>>> invocations' (contrary to 'external invocations') will <br>
>> invoke the<br>
>>>> decorator method<br>
>>>>> example<br>
>>>>> <br>
>>>>> public Class A implements X {<br>
>>>>> <br>
>>>>> <br>
>>>>> public void methA() {..}<br>
>>>>> public void methB() { methA(); }<br>
>>>>> <br>
>>>>> }<br>
>>>>> <br>
>>>>> @Decorator<br>
>>>>> public class Adecorator implements X {<br>
>>>>> @Inject @Delegate X x;<br>
>>>>> <br>
>>>>> public void methA();<br>
>>>>> }<br>
>>>>> <br>
>>>>> If we do _not_ apply subclassing but proxying, then invoking <br>
>> methB will NOT<br>
>>>> trigger methA from Adecorator.<br>
>>>>> If we DO force subclassing, then a call to methB will also <br>
>> trigger the<br>
>>>> decorator!<br>
>>>>> But that is contrary to all other EE proxying behaviour so far...<br>
>>>> <br>
>>>> In weld we currently use a thread local to work around this, so self<br>
>>>> invocation does not result in interceptors / decorators running again.<br>
>>>> <br>
>>>> Stuart<br>
>>>> <br>
>>>>> <br>
>>>>> LieGrue,<br>
>>>>> strub<br>
>>>>> <br>
>>>>> <br>
>>>>> <br>
>>>>> ----- Original Message -----<br>
>>>>>> From: Pete Muir<pmuir@redhat.com><br>
>>>>>> To: Romain Manni-Bucau<rmannibucau@gmail.com><br>
>>>>>> Cc: <br>
>> "cdi-dev@lists.jboss.org"<cdi-dev@lists.jboss.org><br>
>>>>>> Sent: Monday, September 17, 2012 5:58 PM<br>
>>>>>> Subject: Re: [cdi-dev] Subclassing?<br>
>>>>>> <br>
>>>>>> Romain,<br>
>>>>>> <br>
>>>>>> I agree, we can't specify to use subclassing. Please take <br>
>> a look at<br>
>>>>>> </font></tt><tt><font size="2"><a href="https://github.com/jboss/cdi/pull/117">https://github.com/jboss/cdi/pull/117</a></font></tt><tt><font size="2"> where I've tried to <br>
>> address<br>
>>>> this, in<br>
>>>>>> terms of what effects people will see.<br>
>>>>>> <br>
>>>>>> On 17 Sep 2012, at 16:54, Romain Manni-Bucau wrote:<br>
>>>>>> <br>
>>>>>>> Hi,<br>
>>>>>>> <br>
>>>>>>> There is a bunch of jira to specify subclassing should <br>
>> be used in<br>
>>>> some<br>
>>>>>> cases so i mail here instead of answering all jira.<br>
>>>>>>> IMO it is specifying too much the technical part: <br>
>> specify the<br>
>>>> constructor<br>
>>>>>> should be called twice is better for a spec IMHO (but this <br>
>> case is not<br>
>>>> logical<br>
>>>>>> at all ;))<br>
>>>>>>> Why this need?<br>
>>>>>>> <br>
>>>>>>> - Romain<br>
>>>>>>> <br>
>>>>>>> _______________________________________________<br>
>>>>>>> cdi-dev mailing list<br>
>>>>>>> cdi-dev@lists.jboss.org<br>
>>>>>>> </font></tt><tt><font size="2"><a href="https://lists.jboss.org/mailman/listinfo/cdi-dev">https://lists.jboss.org/mailman/listinfo/cdi-dev</a></font></tt><tt><font size="2"><br>
>>>>>> _______________________________________________<br>
>>>>>> cdi-dev mailing list<br>
>>>>>> cdi-dev@lists.jboss.org<br>
>>>>>> </font></tt><tt><font size="2"><a href="https://lists.jboss.org/mailman/listinfo/cdi-dev">https://lists.jboss.org/mailman/listinfo/cdi-dev</a></font></tt><tt><font size="2"><br>
>>>>>> <br>
>>>>> _______________________________________________<br>
>>>>> cdi-dev mailing list<br>
>>>>> cdi-dev@lists.jboss.org<br>
>>>>> </font></tt><tt><font size="2"><a href="https://lists.jboss.org/mailman/listinfo/cdi-dev">https://lists.jboss.org/mailman/listinfo/cdi-dev</a></font></tt><tt><font size="2"><br>
>> <br>
<br>
<br>
_______________________________________________<br>
cdi-dev mailing list<br>
cdi-dev@lists.jboss.org<br>
</font></tt><tt><font size="2"><a href="https://lists.jboss.org/mailman/listinfo/cdi-dev">https://lists.jboss.org/mailman/listinfo/cdi-dev</a></font></tt><tt><font size="2"><br>
<br>
</font></tt><br>
</body></html>