You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by Romain Manni-Bucau <rm...@gmail.com> on 2015/12/18 20:13:20 UTC

Object#method and proxies

Hi guys,

ATM we dont proxy methods in Objects (ie normalScope.toString()) will do a
toString on the proxy - see
org.apache.webbeans.proxy.SubclassProxyFactory#delegateNonInterceptedMethods.

This is fine by itself but then how to enforce the eager init of a bean in
a reliable manner?

Side note: you probably all know the @CdiStartup extension relying on
toString() in after validation event callback and the code I used - and
which fails - was pretty close to that.

FYI I tested only on 1.2.7 but code didnt change much in 1.2.x branch I
think.

Any input/idea?

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

Re: Object#method and proxies

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Le 19 déc. 2015 17:00, "Matt Benson" <gu...@gmail.com> a écrit :
>
> On Dec 19, 2015 9:54 AM, "Romain Manni-Bucau" <rm...@gmail.com>
wrote:
> >
> > Thought it was cause causing delegate init even in debug dtatement when
> > context was not there.
> >
> > But not sure how to solve the "issue".
>
> I'm not familiar with the code, but it would seem that you could delegate
> #toString() any time the proxy already exists. Getting back to the eager
> initialization problem, would an additional introduced interface help?
>

Another API no but we cant really know since the context is user dependent.

> Matt
>
> > Le 19 déc. 2015 16:19, "Mark Struberg" <st...@yahoo.de> a écrit :
> >
> > > We had this in 1.1.x and I remember there was a reason why we removed
> it.
> > > Think it was either because it was slow or because spec/tck forced us.
> Not
> > > sure anymore.
> > > You could grab through the changes in svn.
> > >
> > > LieGrue,
> > > strub
> > >
> > >
> > > > Am 19.12.2015 um 13:56 schrieb Romain Manni-Bucau <
> rmannibucau@gmail.com
> > > >:
> > > >
> > > > It is undefined AFAIK or ambiguous since we pass TCK anyway.
> > > > Le 19 déc. 2015 13:42, "Thomas Andraschko" <
> andraschko.thomas@gmail.com>
> > > a
> > > > écrit :
> > > >
> > > >> Hi,
> > > >>
> > > >> shoudln't toString call the original toString method of the
> contextual
> > > >> instance?
> > > >>
> > > >> 2015-12-18 20:13 GMT+01:00 Romain Manni-Bucau <
rmannibucau@gmail.com
> >:
> > > >>
> > > >>> Hi guys,
> > > >>>
> > > >>> ATM we dont proxy methods in Objects (ie normalScope.toString())
> will
> > > do
> > > >> a
> > > >>> toString on the proxy - see
> > > >>>
> > > >>>
> > > >>
> > >
>
org.apache.webbeans.proxy.SubclassProxyFactory#delegateNonInterceptedMethods.
> > > >>>
> > > >>> This is fine by itself but then how to enforce the eager init of a
> bean
> > > >> in
> > > >>> a reliable manner?
> > > >>>
> > > >>> Side note: you probably all know the @CdiStartup extension relying
> on
> > > >>> toString() in after validation event callback and the code I used
-
> and
> > > >>> which fails - was pretty close to that.
> > > >>>
> > > >>> FYI I tested only on 1.2.7 but code didnt change much in 1.2.x
> branch I
> > > >>> think.
> > > >>>
> > > >>> Any input/idea?
> > > >>>
> > > >>> Romain Manni-Bucau
> > > >>> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > >>> <http://rmannibucau.wordpress.com> | Github <
> > > >>> https://github.com/rmannibucau> |
> > > >>> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > >>> <http://www.tomitribe.com>
> > > >>>
> > > >>
> > >
> > >

Re: Object#method and proxies

Posted by Matt Benson <gu...@gmail.com>.
On Dec 19, 2015 9:54 AM, "Romain Manni-Bucau" <rm...@gmail.com> wrote:
>
> Thought it was cause causing delegate init even in debug dtatement when
> context was not there.
>
> But not sure how to solve the "issue".

I'm not familiar with the code, but it would seem that you could delegate
#toString() any time the proxy already exists. Getting back to the eager
initialization problem, would an additional introduced interface help?

Matt

> Le 19 déc. 2015 16:19, "Mark Struberg" <st...@yahoo.de> a écrit :
>
> > We had this in 1.1.x and I remember there was a reason why we removed
it.
> > Think it was either because it was slow or because spec/tck forced us.
Not
> > sure anymore.
> > You could grab through the changes in svn.
> >
> > LieGrue,
> > strub
> >
> >
> > > Am 19.12.2015 um 13:56 schrieb Romain Manni-Bucau <
rmannibucau@gmail.com
> > >:
> > >
> > > It is undefined AFAIK or ambiguous since we pass TCK anyway.
> > > Le 19 déc. 2015 13:42, "Thomas Andraschko" <
andraschko.thomas@gmail.com>
> > a
> > > écrit :
> > >
> > >> Hi,
> > >>
> > >> shoudln't toString call the original toString method of the
contextual
> > >> instance?
> > >>
> > >> 2015-12-18 20:13 GMT+01:00 Romain Manni-Bucau <rmannibucau@gmail.com
>:
> > >>
> > >>> Hi guys,
> > >>>
> > >>> ATM we dont proxy methods in Objects (ie normalScope.toString())
will
> > do
> > >> a
> > >>> toString on the proxy - see
> > >>>
> > >>>
> > >>
> >
org.apache.webbeans.proxy.SubclassProxyFactory#delegateNonInterceptedMethods.
> > >>>
> > >>> This is fine by itself but then how to enforce the eager init of a
bean
> > >> in
> > >>> a reliable manner?
> > >>>
> > >>> Side note: you probably all know the @CdiStartup extension relying
on
> > >>> toString() in after validation event callback and the code I used -
and
> > >>> which fails - was pretty close to that.
> > >>>
> > >>> FYI I tested only on 1.2.7 but code didnt change much in 1.2.x
branch I
> > >>> think.
> > >>>
> > >>> Any input/idea?
> > >>>
> > >>> Romain Manni-Bucau
> > >>> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > >>> <http://rmannibucau.wordpress.com> | Github <
> > >>> https://github.com/rmannibucau> |
> > >>> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > >>> <http://www.tomitribe.com>
> > >>>
> > >>
> >
> >

Re: Object#method and proxies

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Thought it was cause causing delegate init even in debug dtatement when
context was not there.

But not sure how to solve the "issue".
Le 19 déc. 2015 16:19, "Mark Struberg" <st...@yahoo.de> a écrit :

> We had this in 1.1.x and I remember there was a reason why we removed it.
> Think it was either because it was slow or because spec/tck forced us. Not
> sure anymore.
> You could grab through the changes in svn.
>
> LieGrue,
> strub
>
>
> > Am 19.12.2015 um 13:56 schrieb Romain Manni-Bucau <rmannibucau@gmail.com
> >:
> >
> > It is undefined AFAIK or ambiguous since we pass TCK anyway.
> > Le 19 déc. 2015 13:42, "Thomas Andraschko" <an...@gmail.com>
> a
> > écrit :
> >
> >> Hi,
> >>
> >> shoudln't toString call the original toString method of the contextual
> >> instance?
> >>
> >> 2015-12-18 20:13 GMT+01:00 Romain Manni-Bucau <rm...@gmail.com>:
> >>
> >>> Hi guys,
> >>>
> >>> ATM we dont proxy methods in Objects (ie normalScope.toString()) will
> do
> >> a
> >>> toString on the proxy - see
> >>>
> >>>
> >>
> org.apache.webbeans.proxy.SubclassProxyFactory#delegateNonInterceptedMethods.
> >>>
> >>> This is fine by itself but then how to enforce the eager init of a bean
> >> in
> >>> a reliable manner?
> >>>
> >>> Side note: you probably all know the @CdiStartup extension relying on
> >>> toString() in after validation event callback and the code I used - and
> >>> which fails - was pretty close to that.
> >>>
> >>> FYI I tested only on 1.2.7 but code didnt change much in 1.2.x branch I
> >>> think.
> >>>
> >>> Any input/idea?
> >>>
> >>> Romain Manni-Bucau
> >>> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> >>> <http://rmannibucau.wordpress.com> | Github <
> >>> https://github.com/rmannibucau> |
> >>> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> >>> <http://www.tomitribe.com>
> >>>
> >>
>
>

Re: Object#method and proxies

Posted by Mark Struberg <st...@yahoo.de>.
We had this in 1.1.x and I remember there was a reason why we removed it. 
Think it was either because it was slow or because spec/tck forced us. Not sure anymore. 
You could grab through the changes in svn.

LieGrue,
strub


> Am 19.12.2015 um 13:56 schrieb Romain Manni-Bucau <rm...@gmail.com>:
> 
> It is undefined AFAIK or ambiguous since we pass TCK anyway.
> Le 19 déc. 2015 13:42, "Thomas Andraschko" <an...@gmail.com> a
> écrit :
> 
>> Hi,
>> 
>> shoudln't toString call the original toString method of the contextual
>> instance?
>> 
>> 2015-12-18 20:13 GMT+01:00 Romain Manni-Bucau <rm...@gmail.com>:
>> 
>>> Hi guys,
>>> 
>>> ATM we dont proxy methods in Objects (ie normalScope.toString()) will do
>> a
>>> toString on the proxy - see
>>> 
>>> 
>> org.apache.webbeans.proxy.SubclassProxyFactory#delegateNonInterceptedMethods.
>>> 
>>> This is fine by itself but then how to enforce the eager init of a bean
>> in
>>> a reliable manner?
>>> 
>>> Side note: you probably all know the @CdiStartup extension relying on
>>> toString() in after validation event callback and the code I used - and
>>> which fails - was pretty close to that.
>>> 
>>> FYI I tested only on 1.2.7 but code didnt change much in 1.2.x branch I
>>> think.
>>> 
>>> Any input/idea?
>>> 
>>> Romain Manni-Bucau
>>> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>>> <http://rmannibucau.wordpress.com> | Github <
>>> https://github.com/rmannibucau> |
>>> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
>>> <http://www.tomitribe.com>
>>> 
>> 


Re: Object#method and proxies

Posted by Romain Manni-Bucau <rm...@gmail.com>.
It is undefined AFAIK or ambiguous since we pass TCK anyway.
Le 19 déc. 2015 13:42, "Thomas Andraschko" <an...@gmail.com> a
écrit :

> Hi,
>
> shoudln't toString call the original toString method of the contextual
> instance?
>
> 2015-12-18 20:13 GMT+01:00 Romain Manni-Bucau <rm...@gmail.com>:
>
> > Hi guys,
> >
> > ATM we dont proxy methods in Objects (ie normalScope.toString()) will do
> a
> > toString on the proxy - see
> >
> >
> org.apache.webbeans.proxy.SubclassProxyFactory#delegateNonInterceptedMethods.
> >
> > This is fine by itself but then how to enforce the eager init of a bean
> in
> > a reliable manner?
> >
> > Side note: you probably all know the @CdiStartup extension relying on
> > toString() in after validation event callback and the code I used - and
> > which fails - was pretty close to that.
> >
> > FYI I tested only on 1.2.7 but code didnt change much in 1.2.x branch I
> > think.
> >
> > Any input/idea?
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <http://rmannibucau.wordpress.com> | Github <
> > https://github.com/rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > <http://www.tomitribe.com>
> >
>

Re: Object#method and proxies

Posted by Thomas Andraschko <an...@gmail.com>.
Hi,

shoudln't toString call the original toString method of the contextual
instance?

2015-12-18 20:13 GMT+01:00 Romain Manni-Bucau <rm...@gmail.com>:

> Hi guys,
>
> ATM we dont proxy methods in Objects (ie normalScope.toString()) will do a
> toString on the proxy - see
>
> org.apache.webbeans.proxy.SubclassProxyFactory#delegateNonInterceptedMethods.
>
> This is fine by itself but then how to enforce the eager init of a bean in
> a reliable manner?
>
> Side note: you probably all know the @CdiStartup extension relying on
> toString() in after validation event callback and the code I used - and
> which fails - was pretty close to that.
>
> FYI I tested only on 1.2.7 but code didnt change much in 1.2.x branch I
> think.
>
> Any input/idea?
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com>
>