[code-reflection] RFR: Add isQuotable attribute to LambdaOp [v4]
Paul Sandoz
psandoz at openjdk.org
Fri Sep 5 21:01:26 UTC 2025
On Fri, 5 Sep 2025 02:51:41 GMT, Mourad Abbay <mabbay at openjdk.org> wrote:
>> In the `interpreter` and `ByteCodeGenerator` we detect if a lambda is quotable based on its functional interface. This approach will not work if intersection type is used e.g. `Runnable r = (Runnable & Quotable) () -> {};` This PR adds a flag to LambdaOp that will be set by the `javac` for quotable lambdas.
>
> Mourad Abbay has updated the pull request incrementally with two additional commits since the last revision:
>
> - Correct the way we detect if a lambda is quotable when lifting bytecode
> - Update expected models in tests to include the attribute
src/jdk.incubator.code/share/classes/jdk/incubator/code/bytecode/BytecodeLift.java line 479:
> 477: JavaType.type(inst.typeSymbol().returnType()));
> 478: // if FLAG_QUOTABLE is set, the lambda is quotable
> 479: if (inst.bootstrapArgs().get(inst.bootstrapArgs().size() - 3) instanceof Integer a
IIUC the flags argument should always be the fourth bootstrap argument? See [here](https://github.com/openjdk/babylon/blob/9ca6a4243794b974562c43ed6072dc0575c418ba/src/java.base/share/classes/java/lang/invoke/LambdaMetafactory.java#L510)
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/545#discussion_r2326037006
More information about the babylon-dev
mailing list