[lworld] javac allows Value Type generic parameters with var

Remi Forax forax at univ-mlv.fr
Sat Aug 18 18:05:27 UTC 2018


----- Mail original -----
> De: "James Thompson" <thompsonjamesrichard at gmail.com>
> À: "valhalla-dev" <valhalla-dev at openjdk.java.net>
> Envoyé: Mardi 14 Août 2018 20:13:58
> Objet: [lworld] javac allows Value Type generic parameters with var

> Local type inference with the use of var masks at the source level generic
> type parameters, therefore it is trivial to create a new generic collection
> of Value types.
> 
> e.g. var list = List.of(Point.create(1, 1), Point.create(2, 2));
> 
> where Point is a Value type. This will compile without
> *-XDallowGenericsOverValues*

Thanks James,
i suppose you can also do the same thing with the other kind of type inference, method call and diamond syntax.

regards,
Rémi



More information about the valhalla-dev mailing list