> From: "Brian Goetz" <brian.go...@oracle.com> > To: "Remi Forax" <fo...@univ-mlv.fr> > Cc: "daniel smith" <daniel.sm...@oracle.com>, "Dan Heidinga" > <heidi...@redhat.com>, "John Rose" <john.r.r...@oracle.com>, > "valhalla-spec-experts" <valhalla-spec-experts@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