[picocontainer-dev] Re: Desired behavior for Picocontainer and Static injection

Paul Hammant <[email protected]> Sat, 8 Jun 2013 00:12:32 -0500
Newsgroups gmane.comp.java.picocontainer.devel
Message-ID <CA+298UjPFHczZ=u3Me8jCXB0Mos3_15QR-YnUJJrqNV0tTC57g@mail.gmail.com>
--047d7b15a8d13c5c4004de9d9871
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

Mike,

I'm not really happy with JSR330's patronage of injection into class
variables.  If we had to say we're not going to do it, but we'll do
everything else from JSR 330 that's instance based, then I'd not be unhappy=
.

Can we do it in a separate class?  StaticEnabledPicoContainer (implements
MPC, has-a DPC) ?  Then it's a take it or leave it thing.


On Wed, Jun 5, 2013 at 12:04 AM, Michael Rimov <[email protected]>wrote=
:

> Ok, so this is the last thing on the todo list to get the TCK + all
> optional tests running for JSR-330.****
>
> ** **
>
> The TCK wants static initialization, but to keep track of things so that
> we only inject statics one time.****
>
> ** **
>
> To me that means we have to maintain some sort of state about what=92s be=
en
> initialized, but what scope?****
>
> ** **
>
> Do we do it across all containers?  (ie a static variable inside default
> picocontainer)  (for the record, my own personal opinion on this solution=
=85
> ick!)****
>
> ** **
>
> Personally I=92m of the opinion that we keep track of static initializati=
on
> once per container.  (via a Non static member variable, probably a
> WeakHashSet=85 weak so it doesn=92t prevent classloaders from gc=92ing a =
class?)
> ****
>
> ** **
>
> If we have multiple containers (not in a parent-child way) referencing th=
e
> same class, then it would mean that a static variable will be initialized
> multiple times, but personally I think this is an edge case behavior that
> we can live with compared to having to have Static variables inside DPC.
> ****
>
> ** **
>
> I suppose a complicated way would be to run a class enhancer to offload
> the state information there=85 but that seems like a lot of work for what=
 we
> would call an recommended way of doing things.****
>
> ** **
>
> Thoughts?****
>
> ** **
>
>
> -Mike****
>

--047d7b15a8d13c5c4004de9d9871
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><span style=3D"font-family:arial,sans-serif;font-size:13px=
">Mike,</span><div style=3D"font-family:arial,sans-serif;font-size:13px"><b=
r></div><div style=3D"font-family:arial,sans-serif;font-size:13px">I&#39;m =
not really happy with JSR330&#39;s patronage of injection into class variab=
les. =A0If we had to say we&#39;re not going to do it, but we&#39;ll do eve=
rything else from JSR 330 that&#39;s instance based, then I&#39;d not be un=
happy.</div>
<div style=3D"font-family:arial,sans-serif;font-size:13px"><br></div><div s=
tyle=3D"font-family:arial,sans-serif;font-size:13px">Can we do it in a sepa=
rate class? =A0StaticEnabledPicoContainer (implements MPC, has-a DPC) ? =A0=
Then it&#39;s a take it or leave it thing.</div>
</div><div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">On Wed,=
 Jun 5, 2013 at 12:04 AM, Michael Rimov <span dir=3D"ltr">&lt;<a href=3D"ma=
ilto:[email protected]" target=3D"_blank">[email protected]</a>&gt;=
</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div lang=3D"EN-US" link=3D"blue" vlink=3D"p=
urple"><div><p class=3D"MsoNormal">Ok, so this is the last thing on the tod=
o list to get the TCK + all optional tests running for JSR-330.<u></u><u></=
u></p>
<p class=3D"MsoNormal"><u></u>=A0<u></u></p><p class=3D"MsoNormal">The TCK =
wants static initialization, but to keep track of things so that we only in=
ject statics one time.<u></u><u></u></p><p class=3D"MsoNormal"><u></u>=A0<u=
></u></p>
<p class=3D"MsoNormal">To me that means we have to maintain some sort of st=
ate about what=92s been initialized, but what scope?<u></u><u></u></p><p cl=
ass=3D"MsoNormal"><u></u>=A0<u></u></p><p class=3D"MsoNormal">Do we do it a=
cross all containers?=A0 (ie a static variable inside default picocontainer=
)=A0 (for the record, my own personal opinion on this solution=85 ick!)<u><=
/u><u></u></p>
<p class=3D"MsoNormal"><u></u>=A0<u></u></p><p class=3D"MsoNormal">Personal=
ly I=92m of the opinion that we keep track of static initialization once pe=
r container.=A0 (via a Non static member variable, probably a WeakHashSet=
=85 weak so it doesn=92t prevent classloaders from gc=92ing a class?)=A0 <u=
></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=A0<u></u></p><p class=3D"MsoNormal">If we ha=
ve multiple containers (not in a parent-child way) referencing the same cla=
ss, then it would mean that a static variable will be initialized multiple =
times, but personally I think this is an edge case behavior that we can liv=
e with compared to having to have Static variables inside DPC.=A0 <u></u><u=
></u></p>
<p class=3D"MsoNormal"><u></u>=A0<u></u></p><p class=3D"MsoNormal">I suppos=
e a complicated way would be to run a class enhancer to offload the state i=
nformation there=85 but that seems like a lot of work for what we would cal=
l an recommended way of doing things.<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=A0<u></u></p><p class=3D"MsoNormal">Thoughts=
?<u></u><u></u></p><p class=3D"MsoNormal"><u></u>=A0<u></u></p><p class=3D"=
MsoNormal">=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0 -Mike<u></u><u></u></p>
</div></div></blockquote></div><br></div>

--047d7b15a8d13c5c4004de9d9871--