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'd love help. =A0Nice work. Zero deps =3D=3D I like. =A0 I'm = 90% confident that Pico (BSD) can import Apache License 2.0 code w/o proble= m. =A0But just out of interest, why'd you never consider BSD ? =A0Or is= it your employer's choice ?<div> <br></div><div>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*. =A0We al= ready do this for Paranamer, so I think its fine. =A0However that's alm= ost invisible. =A0With a type system though, there's a possibility that= someone else using the type system, might curse us for making that decisio= n. =A0We'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"><<a href=3D"mailto:[email protected]= m">[email protected]</a>></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'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<T> [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'll need.<br> <br> I'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 <<a href=3D"mailto:[email protected]"= >[email protected]</a>> wrote:<br> > Hi folks,<br> > I'm working towards JSR330 compatibility in the Git Pico3 repo. = =A0There's a<br> > TCK that comes with JSR330 so tracking progress is easy.<br> > First up, I've had to add a mechanism to a) preserve type erasure = and b)<br> > allow lookup based on types. =A0Looking at the PicoContainer API, you&= #39;ll see<br> > =A0=A0 =A0<T> T getComponent(TypeOf<T> componentType);<br> > .. in addition to ..<br> > =A0=A0 =A0<T> T getComponent(Class<T> componentType);<br> > TypeOf is used rather than Type itself because one cannot do the follo= wing<br> > in Java:<br> > =A0=A0 =A0 List<Color> colors =3D pico.getComponent(List<Colo= r>.class);<br> > Instead (and like Guice), we'll have to do:<br> > =A0=A0 =A0 List<Color> colors =3D pico.getComponent(new TypeOf&l= t;Color>(){}); // note<br> > the anon inner class<br> > TypeOf is doing a=A0getGenericSuperclass() call to preserve the generi= cs info.<br> > =A0I've to think more about references being held to TypeOf instan= ces because<br> > of the inner class consequences for garbage collection.<br> > Internally, PicoContainer is moving towards using TypeOf as the genera= l key<br> > for items. =A0Thus even 'old fashioned' Class keys are morphed= into TypeOfs<br> > via TypeOf.fromClass(Class c) calls.<br> > - 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--