Notes on implementing concise calls to constructors with type parameters

Rémi Forax forax at
Thu May 14 16:41:48 PDT 2009

Alex Buckley a écrit :
> Ulf, you ask why:
>    Cell<String> cs = new Cell(1); //unchecked warning
>    String s = cs.x; //CCE at runtime
> cannot be rejected at compile-time, presumably with an error rather than 
> a warning on the assignment.
> The answer is migration compatibility: it is desirable for new, 
> generified code (Cell<String> cs = ...) to be able to call legacy, 
> ungenerified code (that returns a raw Cell type).
> There is a potential CCE resulting from this call - as indeed there is 
> anytime raw types are used by generified code - so the language requires 
> a compile-time WARNING when this migration feature is used.
> There is no conceivable "upgrade" to this behavior in the JLS.
Re-read section 4.8 of the JLS :)
*"It is possible that future versions of the Java programming language 
will disallow the use of raw types."
So it's seems that someone, one day conceive that.

and with javac
javac -Xlint:raw -Werror ...
> For the record, this is nothing to do with erasure/reification.
> Alex

More information about the coin-dev mailing list