[code-reflection] RFR: Lazily invoke lambda op building method [v3]

Paul Sandoz psandoz at openjdk.org
Fri Dec 19 22:43:21 UTC 2025


On Fri, 19 Dec 2025 22:32:08 GMT, Mourad Abbay <mabbay at openjdk.org> wrote:

>> Validation introduced in #738 is causing reflectable lambda creation to fail with an `InternalError`. The reason for this is that we are invoking lambda op building method in the lambda class static initializer, when lambda op building method throws UOE, it causes lambda creation to fail with `InternalError`. What we want is `Op.ofQuotable` to fail but not lambda instantiation. To adress this, we now lazily invoke lambda op building method and as result we lazily compute the `Quoted` instance, while sharing the lambda model across instances of the same lambda class.
>
> Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Apply suggestions

Marked as reviewed by psandoz (Lead).

src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java line 564:

> 562:         /*
> 563:         private static synchronized CoreOp.FuncOp getModel() {
> 564:             if(model == null) {

Suggestion:

            if (model == null) {

-------------

PR Review: https://git.openjdk.org/babylon/pull/769#pullrequestreview-3600355819
PR Review Comment: https://git.openjdk.org/babylon/pull/769#discussion_r2636485889


More information about the babylon-dev mailing list