Re: [picocontainer-dev] JSR330 work progress

Paul Hammant <[email protected]> Fri, 30 Jul 2010 09:29:40 -0500
Newsgroups gmane.comp.java.picocontainer.devel
Message-ID <[email protected]>
--000e0cd32ede6b4c07048c9bae8c
Content-Type: text/plain; charset=ISO-8859-1

Sure I'd love help.  Nice work. Zero deps == I like.   I'm 90% confident
that Pico (BSD) can import Apache License 2.0 code w/o problem.  But just
out of interest, why'd you never consider BSD ?  Or is it your employer's
choice ?

If its a good fit, I think we should perhaps 'shade' it in to the Pico jar,
such that Pico's deps don't grow*.  We already do this for Paranamer, so I
think its fine.  However that's almost invisible.  With a type system
though, there's a possibility that someone else using the type system, might
curse us for making that decision.  We'd need to play through some real-life
scenarios before we worked out whether that was right or wrong.

Things for pinging us Mark.

- Paul

* JSR 330 / @Inject might have to be an external dep.

On Fri, Jul 30, 2010 at 5:19 AM, Mark Hobson <[email protected]> wrote:

> Good to see that work is progressing on JSR330 Paul!
>
> I know I've mentioned it before, and it may be more pertinent now
> regarding TypeOf, but JType [1] has support for type literals via
> Generic<T> [2].  It also provides various factory methods to construct
> them in Generics and implements the complicated type assignability
> logic in TypeUtils.isAssignable, which I guess you'll need.
>
> I'm happy to help out from the JType side of things if you wanted to
> integrate it into Pico?
>
> Cheers,
>
> Mark
>
> [1] http://code.google.com/p/jtype/
> [2]
> http://jtype.googlecode.com/svn/site/apidocs/com/googlecode/jtype/Generic.html
>
> On 23 July 2010 10:23, Paul Hammant <[email protected]> wrote:
> > Hi folks,
> > I'm working towards JSR330 compatibility in the Git Pico3 repo.  There's
> a
> > TCK that comes with JSR330 so tracking progress is easy.
> > First up, I've had to add a mechanism to a) preserve type erasure and b)
> > allow lookup based on types.  Looking at the PicoContainer API, you'll
> see
> >     <T> T getComponent(TypeOf<T> componentType);
> > .. in addition to ..
> >     <T> T getComponent(Class<T> componentType);
> > TypeOf is used rather than Type itself because one cannot do the
> following
> > in Java:
> >      List<Color> colors = pico.getComponent(List<Color>.class);
> > Instead (and like Guice), we'll have to do:
> >      List<Color> colors = pico.getComponent(new TypeOf<Color>(){}); //
> note
> > the anon inner class
> > TypeOf is doing a getGenericSuperclass() call to preserve the generics
> info.
> >  I've to think more about references being held to TypeOf instances
> because
> > of the inner class consequences for garbage collection.
> > Internally, PicoContainer is moving towards using TypeOf as the general
> key
> > for items.  Thus even 'old fashioned' Class keys are morphed into TypeOfs
> > via TypeOf.fromClass(Class c) calls.
> > - Paul
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

--000e0cd32ede6b4c07048c9bae8c
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Sure I&#39;d love help. =A0Nice work. Zero deps =3D=3D I like. =A0 I&#39;m =
90% confident that Pico (BSD) can import Apache License 2.0 code w/o proble=
m. =A0But just out of interest, why&#39;d you never consider BSD ? =A0Or is=
 it your employer&#39;s choice ?<div>
<br></div><div>If its a good fit, I think we should perhaps &#39;shade&#39;=
 it in to the Pico jar, such that Pico&#39;s deps don&#39;t grow*. =A0We al=
ready do this for Paranamer, so I think its fine. =A0However that&#39;s alm=
ost invisible. =A0With a type system though, there&#39;s a possibility that=
 someone else using the type system, might curse us for making that decisio=
n. =A0We&#39;d need to play through some real-life scenarios before we work=
ed out whether that was right or wrong.</div>
<div><br></div><div>Things for pinging us Mark.</div><div><br></div><div>- =
Paul<br><div><br><div>* JSR 330 / @Inject might have to be an external dep.=
 =A0</div><div><br><div class=3D"gmail_quote">On Fri, Jul 30, 2010 at 5:19 =
AM, Mark Hobson <span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]=
m">[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;">Good to see that work is progressing on JSR=
330 Paul!<br>
<br>
I know I&#39;ve mentioned it before, and it may be more pertinent now<br>
regarding TypeOf, but JType [1] has support for type literals via<br>
Generic&lt;T&gt; [2]. =A0It also provides various factory methods to constr=
uct<br>
them in Generics and implements the complicated type assignability<br>
logic in TypeUtils.isAssignable, which I guess you&#39;ll need.<br>
<br>
I&#39;m happy to help out from the JType side of things if you wanted to<br=
>
integrate it into Pico?<br>
<br>
Cheers,<br>
<br>
Mark<br>
<br>
[1] <a href=3D"http://code.google.com/p/jtype/" target=3D"_blank">http://co=
de.google.com/p/jtype/</a><br>
[2] <a href=3D"http://jtype.googlecode.com/svn/site/apidocs/com/googlecode/=
jtype/Generic.html" target=3D"_blank">http://jtype.googlecode.com/svn/site/=
apidocs/com/googlecode/jtype/Generic.html</a><br>
<div><div></div><div class=3D"h5"><br>
On 23 July 2010 10:23, Paul Hammant &lt;<a href=3D"mailto:[email protected]"=
>[email protected]</a>&gt; wrote:<br>
&gt; Hi folks,<br>
&gt; I&#39;m working towards JSR330 compatibility in the Git Pico3 repo. =
=A0There&#39;s a<br>
&gt; TCK that comes with JSR330 so tracking progress is easy.<br>
&gt; First up, I&#39;ve had to add a mechanism to a) preserve type erasure =
and b)<br>
&gt; allow lookup based on types. =A0Looking at the PicoContainer API, you&=
#39;ll see<br>
&gt; =A0=A0 =A0&lt;T&gt; T getComponent(TypeOf&lt;T&gt; componentType);<br>
&gt; .. in addition to ..<br>
&gt; =A0=A0 =A0&lt;T&gt; T getComponent(Class&lt;T&gt; componentType);<br>
&gt; TypeOf is used rather than Type itself because one cannot do the follo=
wing<br>
&gt; in Java:<br>
&gt; =A0=A0 =A0 List&lt;Color&gt; colors =3D pico.getComponent(List&lt;Colo=
r&gt;.class);<br>
&gt; Instead (and like Guice), we&#39;ll have to do:<br>
&gt; =A0=A0 =A0 List&lt;Color&gt; colors =3D pico.getComponent(new TypeOf&l=
t;Color&gt;(){}); // note<br>
&gt; the anon inner class<br>
&gt; TypeOf is doing a=A0getGenericSuperclass() call to preserve the generi=
cs info.<br>
&gt; =A0I&#39;ve to think more about references being held to TypeOf instan=
ces because<br>
&gt; of the inner class consequences for garbage collection.<br>
&gt; Internally, PicoContainer is moving towards using TypeOf as the genera=
l key<br>
&gt; for items. =A0Thus even &#39;old fashioned&#39; Class keys are morphed=
 into TypeOfs<br>
&gt; via TypeOf.fromClass(Class c) calls.<br>
&gt; - Paul<br>
<br>
</div></div>---------------------------------------------------------------=
------<br>
To unsubscribe from this list, please visit:<br>
<br>
 =A0 =A0<a href=3D"http://xircles.codehaus.org/manage_email" target=3D"_bla=
nk">http://xircles.codehaus.org/manage_email</a><br>
<br>
<br>
</blockquote></div><br></div></div></div>

--000e0cd32ede6b4c07048c9bae8c--