RefObject and ValObject
Brian Goetz
brian.goetz at oracle.com
Mon Apr 15 21:17:14 UTC 2019
In the document on “Towards a plan for L10 / L20” I tried to answer these, but I got it slightly wrong. I said:
V <: V? <: ValObject <: Object
But really that should be
V <: V? <: ValObject? <: Object
V <: ValObject <: Object
V <: V? by value set inclusion; V? is the type obtained by adjoining `null` to the value set of V.
I am leaning towards saying that `RefObject?` and `Object?` are not sensible things to write, because they are equal to `RefObject` and `Object`. (That’s separately from `T?`, which always makes sense, but sometimes just means “T”.).
No flavor of Point is a subtype of any flavor of RefObject; ValObject and RefObject are disjoint.
> On Apr 15, 2019, at 5:10 PM, forax at univ-mlv.fr wrote:
>
>
>
> De: "Brian Goetz" <brian.goetz at oracle.com>
> À: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "Maurizio Cimadamore" <maurizio.cimadamore at oracle.com>, "valhalla-spec-experts" <valhalla-spec-experts at openjdk.java.net>
> Envoyé: Lundi 15 Avril 2019 22:46:08
> Objet: Re: RefObject and ValObject
> yes !
> all generics will suddenly accept value types.
>
>
> Yes, this is by design. If you can’t have an ArrayList of Point, that would be terrible. Of course, until we have specialization (later in the story), these will be erased, and restricted to the nullable projection.
>
> Does it means that Point? is a subtype of RefObject ?
>
> Note: the second question mark in this sentence is because it's a question.
>
> Rémi
>
More information about the valhalla-spec-observers
mailing list