[External] : Re: Do we even need IO/VO interfaces? (was: JEP update: Value Objects)
forax at univ-mlv.fr
forax at univ-mlv.fr
Tue Dec 21 01:00:05 UTC 2021
> From: "Brian Goetz" <brian.goetz at oracle.com>
> To: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "daniel smith" <daniel.smith at oracle.com>, "Dan Heidinga"
> <heidinga at redhat.com>, "John Rose" <john.r.rose at oracle.com>,
> "valhalla-spec-experts" <valhalla-spec-experts at openjdk.java.net>
> Sent: Mardi 21 Décembre 2021 01:07:15
> Subject: Re: [External] : Re: Do we even need IO/VO interfaces? (was: JEP
> update: Value Objects)
>>> Introducing new interfaces that have no methods is clearly source- and binary
>>> compatible, so I am not particularly compelled by "some very brittle and badly
>>> written code might break." So far, no one has proposed any examples that would
>>> make us reconsider that.
>> ??;
>> you are forgetting inference, this code will fail to compile
>> class A {}
>> class B {}
>> var list = List.of(new A(), new B());
>> List<Object> list2 = list:
> Good catch. There is precedent for leaving certain interfaces out of inference,
> though; I suspect we will want to do this for these interfaces too.
The problem is that these interfaces are only useful if they are propagated along the expression flow.
But
- if something is typed Object or Object[], that information is lost
- if something is typed with an interface, that information is lost (only the concrete classes implement those interfaces)
- you are saying that in case of inference, they are removed from the flow too.
It seems they are only useful on a blue moon.
Rémi
More information about the valhalla-spec-observers
mailing list