Notes on implementing concise calls to constructors with type parameters

Ulf Zibis Ulf.Zibis at gmx.de
Thu May 14 10:39:26 PDT 2009


Am 14.05.2009 16:43, Maurizio Cimadamore schrieb:
> Ulf Zibis wrote:
>> Hm, precisely I meant, if there is any difference in the instantiated 
>> object, and it's behaviour. Is it?
>>   
> The instantiated object will be similar but given the class:
>
> class Cell<X> {
> X x;
> Cell(X x) {this.x = x;}
> }
>
> the following code is unsafe:
>
> Cell<String> cs = new Cell(1); //unchecked warning
> String s = cs.x; //CCE at runtime


Again: Why couldn't compiler reject this as error, or is there any reason, why not?

-Ulf








More information about the coin-dev mailing list