Notes on implementing concise calls to constructors with type parameters

Ulf Zibis Ulf.Zibis at
Thu May 14 08:34:00 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

Thanks very much for this. Now I understand. I didn't know, that 
compiler would allow 1. line.
IMHO this should be rejected as error from compiler side, or is there 
any reason, why not?


More information about the coin-dev mailing list