JEP draft: Universal Generics
amalloy at google.com
Tue Jun 8 23:51:09 UTC 2021
> Type variables can thus range over almost any type
I'm curious what exceptions you had in mind there. void?
The "Null pollution and null warnings" section mentions
> A warning occurs when a non-final field with a type variable type is left
uninitialized by a constructor.
which made me wonder: Are there any bounds where this warning isn't
necessary? For example, what about <T extends IdentityObject>?
I think the "Reference type variable types" section covers that, but maybe
the prior section could be worded less universally. "with a type variable
type that could be instantiated with a primitive type" or something.
On Tue, Jun 8, 2021 at 2:21 PM Dan Smith <daniel.smith at oracle.com> wrote:
> Please see this JEP draft:
> This is the third anticipated piece in our initial suite of Valhalla
> preview features (along with JEPs 401 and 402). It's also the first step in
> the revised generics story, to be followed up in the future with JVM
> enhancements for better performance (including species & type restrictions).
> This is entirely a language enhancement, and will be experienced by
> developers as a number of new warnings for generic classes and methods.
> Addressing the warnings makes generic APIs interoperate smoothly with
> primitive value types and prepares them for the future JVM enhancements.
More information about the valhalla-spec-observers