[code-reflection] RFR: Fix lambda bugs [v8]
Maurizio Cimadamore
mcimadamore at openjdk.org
Mon Sep 1 10:27:55 UTC 2025
On Fri, 29 Aug 2025 21:36:15 GMT, Mourad Abbay <mabbay at openjdk.org> wrote:
>> Fix lambda bugs:
>> 1. Unnecessary load of static fields accessed inside the lambda body (bug 1).
>> 2. The model of a lambda expression that returns void, contains additional boxing whose result is not used (bug 2).
>> 3. Inner lambda is incorrectly quoted (bug 3).
>
> 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
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/532#discussion_r2313557170
More information about the babylon-dev
mailing list