Hi Vojin, I think it would be useful to include such a test (for capturing and non-capturing) to protect against a regression.
Thanks, Paul. > On Oct 29, 2019, at 3:57 AM, Vojin Jovanovic <vojin.jovano...@oracle.com> > wrote: > > The only way I see to test this (without calling LMF directly) is to inspect > the stack trace created in a static initialiser of a lambda super-type. The > stack trace should not contain LMF when > -Djdk.internal.lambda.disableEagerInitialization=true. Let me know if this > kind of a test reasonable; I can easily add it. — Vojin > >> On 29 Oct 2019, at 00:29, Paul Sandoz <paul.san...@oracle.com> wrote: >> >>> >>> On Oct 28, 2019, at 3:29 PM, mark.reinh...@oracle.com wrote: >>> >>> 2019/10/28 11:10:25 -0700, vojin.jovano...@oracle.com: >>>> This email proposes a change to the LambdaMetaFactory that allows to >>>> disable eager initialization (with Unsafe) of generated lambdas. ... >>>> >>>> ... >>>> >>>> After the discussion with Brian Goetz, we have trimmed down to the >>>> following change: >>>> >>>> https://bugs.openjdk.java.net/secure/attachment/85247/lambda-disable-initialization.diff >>>> >>>> The evolution of this change can be found at the issue: >>>> >>>> https://bugs.openjdk.java.net/browse/JDK-8232806 >>> >>> Vojin -- I’d be happy to sponsor this change on your behalf. >>> >>> I’ve posted a webrev that incorporates the suggestions that Paul and >>> Rémi made in the JBS issue: >>> >>> https://cr.openjdk.java.net/~mr/rev/8232806/ >>> >>> Paul, Rémi -- please make sure that I understood your suggestions >>> correctly >> >> Looks good to me. >> >> I don’t know of an easy way to test when the new sys property is true that >> the implementing class is not initialized. Seems to require an explicit call >> to LMF, cracking open the calls site’s target, and calling >> Unsafe.shouldBeInitialized (presuming initialization is not tickled before >> that call and the call works!). Perhaps a future exercise if someone wanna >> takes that on. >> >> Paul. >