----- Original Message ----- > From: "Dan Heidinga" <heidi...@redhat.com> > To: "Remi Forax" <fo...@univ-mlv.fr> > Cc: "daniel smith" <daniel.sm...@oracle.com>, "valhalla-spec-experts" > <valhalla-spec-experts@openjdk.java.net> > Sent: Thursday, January 27, 2022 4:41:14 PM > Subject: Re: SoV-3: constructor questions
>> >> The reason John gave for allowing a <new> method to return a super type is >> for >> lambda proxies. >> >> A lambda proxies is a hidden value class, i.e. a value class loaded by >> lookup.defineHiddenClass(), >> given that a hidden class as no real name, the idea is to use Object or >> perhaps >> the functional interface as return type. >> If the functional interface is used, there will be no weird cast in the >> bytecode. >> > > Right. I'm suggesting we remove any restrictions on the return type > for `<new>` methods as we've identified cases (like the hidden value > class) where restrictions are problematic and haven't clearly > identified the benefits from these restrictions. It feels like we're > trying to specify a "best practice" while leaving an escape hatch > cause we know we need it. Seems like it would be better to not add > the restriction in the first place. yes, i agree on that. > > --Dan Rémi