JEP 300: Augment Use-Site Variance with Declaration-Site Defaults
Remi Forax
forax at univ-mlv.fr
Wed Dec 7 16:21:11 UTC 2016
This JEP is very important,
it will greatly reduce the need of using wilcards, by example, it will remove a lot of boilerplate in the javadoc of the Stream API making it even readable by undergrads.
There is an issue which is not discussed by this JEP,
if you declare Optional<covariant T>, it will fail because Optional as a method orElse defined like this: E orElse(E).
I wonder if not unlike @SafeVarargs we can introduce an annotation (or a keyword) to say that the E taken as parameter is not stored in the Optional, thus, it's safe to declare Optional<covariant T>.
regards,
Rémi
----- Mail original -----
> De: "mark reinhold" <mark.reinhold at oracle.com>
> À: "daniel smith" <daniel.smith at oracle.com>
> Cc: platform-jep-discuss at openjdk.java.net
> Envoyé: Mercredi 7 Décembre 2016 00:48:00
> Objet: JEP 300: Augment Use-Site Variance with Declaration-Site Defaults
> New JEP Candidate: http://openjdk.java.net/jeps/300
>
> - Mark
More information about the platform-jep-discuss
mailing list