avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leo Sutic" <leo.su...@inspireinfrastructure.com>
Subject RE: Java 1.5, fun with lookups and generics
Date Wed, 28 Jan 2004 18:48:01 GMT


> From: Jonathan Hawkes [mailto:jhawkes@adsnm.com] 
> 
> You're still casting.  You're just postponing it a little. 

The purpose of this isn't to eliminate casts altogether - I don't
see how that can be possible given that we are dealing with
types (the component instances) that aren't known at compile-time.

But:

> DefaultServiceManager.lookup does a cast to type T.

And that is the good part of this: We got the casting out of the
client code and put it in the container code. This means that
the client will be a bit more compile-time checked at the cost
of the container being a little less compile-time checked. Since
the container is considered to be the most-tested of those two
codebases (due to it being common code used by many people),
this tradeoff makes sense.

/LS


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


Mime
View raw message