On Wednesday 28 January 2004 10:06, Leo Sutic wrote:
> > From: Niclas Hedhman [mailto:[EMAIL PROTECTED]
> > And that would be compile time checkable???
>
> Yes.
> Given:
> public <T> T lookup (String key) throws Exception;
> an instantiation specified as:
> sm.<MyComponent>lookup( ... )
> that is, with T = MyComponent, will be:
> public MyComponent lookup (String key) throws Exception;
How is that possible? Given;
private Object doGet (String key) {
if (key.equals ("A")) return new A();
if (key.equals ("B")) return new B();
return null;
}
A a = sm.<A>lookup ("B");
How would the compiler know?
Niclas
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]