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

Mourad Abbay mabbay at openjdk.org
Mon Sep 1 15:36:03 UTC 2025


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

>> Mourad Abbay has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 10 additional commits since the last revision:
>> 
>>  - Merge branch 'code-reflection' into lambda-bugs
>>  - Apply review comments
>>  - Clarify comment
>>  - Fix bug 3
>>  - Add test cases to ensure bug 2 is fixed
>>  - Fix bug 2
>>  - Fix the bug of lambda model containing ReturnOp with value even though the lambda return type is void
>>  - Add test case to ensure bug 1 is fixed
>>  - Merge branch 'code-reflection' into lambda-bugs
>>  - Fix lambda bug 1
>
> src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/ReflectMethods.java line 1037:
> 
>> 1035:                     if (sym.name.equals(names._this) || sym.name.equals(names._super)) {
>> 1036:                         result = thisValue();
>> 1037:                     } else if (top.localToOp.containsKey(sym)) {
> 
> The correct check would be to see if `sym.getConstValue() != null`, which is also what the discriminator used by `QuotedLambdaScanner`:
> https://github.com/mabbay/babylon/blob/77f2c77957677a95115bc9c829809ea099e20080/src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/ReflectMethods.java#L577C73-L577C87

That check won't be enough, because for methods we don't register constant captured fields.
We need to check that `sym.getConstValue() != null && isQuoted`

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

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


More information about the babylon-dev mailing list