avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niclas Hedhman <nic...@hedhman.org>
Subject Re: Java 1.5, fun with lookups and generics
Date Wed, 28 Jan 2004 19:29:27 GMT
On Wednesday 28 January 2004 10:55, Leo Sutic wrote:
> > From: Niclas Hedhman [mailto:niclas@hedhman.org]
> >  A a = sm.<A>lookup ("B");
> >
> > How would the compiler know?
> OK, *that* is something that can't be statically checked. The upside is
> that
> we've isolated the *only* part that can't be statically checked, and
> we've isolated it in the container:

A a = sm.<A>lookup ("B");
A a = (A) sm.lookup ("B");

So where is the famous difference. I don't care if I get a ClassCastException 
on this line, or the cast in the ServiceManager.

More interestingly though, what about;

A a = sm.<A>lookup();

Can the ServiceManager do the equivalent of 
   Class c = T.class;

So that Merlin could lookup a proper type without argument in the lookup?

That would be nice! (Although it may be years away before we can do it.)


To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org

View raw message