Notes on implementing concise calls to constructors with type parameters

Ulf Zibis Ulf.Zibis at gmx.de
Thu May 14 14:31:47 PDT 2009


Am 14.05.2009 20:12, Neal Gafter schrieb:
> On Thu, May 14, 2009 at 10:39 AM, Ulf Zibis <Ulf.Zibis at gmx.de 
> <mailto:Ulf.Zibis at gmx.de>> wrote:
>
>     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?
>
>
> The compiler may not reject this because there is no static error 
> according to the rules of the language as defined by the Java Language 
> Specification.

So no functionality would break, if this accordingly would be upgraded 
in the Java Language Specification?

-Ulf





More information about the coin-dev mailing list