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

Mourad Abbay mabbay at openjdk.org
Mon Sep 1 15:39:00 UTC 2025


On Mon, 1 Sep 2025 10:13:26 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 1504:
> 
>> 1502:             Type lambdaReturnType = tree.getDescriptorType(types).getReturnType();
>> 1503:             if (tree.getBodyKind() == LambdaExpressionTree.BodyKind.EXPRESSION) {
>> 1504:                 Value exprVal = toValue(((JCExpression) tree.body), lambdaReturnType);
> 
> I'd be tempted to check for `void` even before calling `toValue` -- it's a bit odd that we have to explicitly check for `VOID` in `coerce`

We can check for `null` or `void` target type in `toValue`. Checking before `toValue` may require changes several places.

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

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


More information about the babylon-dev mailing list