SoV-3: constructor questions

Dan Heidinga heidinga at redhat.com
Thu Jan 27 15:41:14 UTC 2022


>
> 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.

--Dan



More information about the valhalla-spec-experts mailing list