[code-reflection] RFR: Fix lambda bugs [v5]

Mourad Abbay mabbay at openjdk.org
Mon Sep 1 15:51:57 UTC 2025


On Mon, 1 Sep 2025 10:30:40 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> test/langtools/tools/javac/reflect/QuotableSubtypeTest.java line 328:
>> 
>>> 326:             };
>>> 327:             """)
>>> 328:     // @@@ should this be the excepted behaviour in case we have a nested quotable lambda ?
>> 
>> Yes, the program behavior is to produce an instance of a functional interface whose implementation is bound to the lambda's body. Because the lambda is also targeted to a `Quotable` interface, there is additional program behaviour that gives access to the code model of the lambda via a corresponding Quoted instance.
>
> I'm not sure about this... I get that the inner lambda has its own synthetic method with its own code model. But, if I take the outer lambda an execute it, e.g. using the Interpreter or BytecodeGenerator, won't I then have an issue -- as we would have lost the information that the nested lambda was quotable and, as such, required different treatment?

The interpreter will make sure calling Op.ofQuotable for the inner lambda would return Quoted instance that has the  model of the lambda.

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

PR Review Comment: https://git.openjdk.org/babylon/pull/532#discussion_r2314266568


More information about the babylon-dev mailing list