Notes on implementing concise calls to constructors with type parameters

Ulf Zibis Ulf.Zibis at gmx.de
Fri May 15 02:16:47 PDT 2009


Am 15.05.2009 10:57, Ali Ebrahimi schrieb:
>
> My answer is that using a transparent diamond operator in *instantiation
> of generic* types by jdk7+.
> The code
> **Cell<String> cs = new Cell(1); *
> if* Cell is generic class then goto GENERIC_CASE
>   

I guess you mean:

if* new Cell(1) invokes generic type constructor then goto GENERIC_CASE



> **GENERIC_CASE:
> *   treated as :
> *   Cell<String> cs = new Cell<>(1); *
>
>    and this treated as:
>
> *   Cell<String> cs = new Cell<**String**>(1); *
>    goto Next:
>
> else // raw type(legacy code)
> RAW_CASE:
>    *Cell<String> cs = new Cell(1); *
>
> Next:
>
> And finally catching compile time error.
>   

Better:
And finally catching compile time error for *GENERIC_CASE*, but no error 
for *RAW_CASE*

;-)

-Ulf





More information about the coin-dev mailing list