[code-reflection] RFR: Test Switch Expression lowering when case is constant [v2]

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Jul 22 09:07:51 UTC 2024


On Mon, 22 Jul 2024 09:04:05 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 six additional commits since the last revision:
>> 
>>  - Create overloads of method toValue.
>>  - Merge branch 'code-reflection' into test-sw-lowering
>>  - Merge branch 'code-reflection' into test-sw-lowering
>>  - Remove misleading comment
>>  - Test switch expression lowering when case is constant
>>  - Remove switch expression lowering tests
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ReflectMethods.java line 1378:
> 
>> 1376:             // Scan the lambda body
>> 1377:             if (tree.getBodyKind() == LambdaExpressionTree.BodyKind.EXPRESSION) {
>> 1378:                 Value exprVal = toValue(((JCExpression) tree.body), tree.getDescriptorType(types).getReturnType());
> 
> This cast is probably redundant, as there's no variant of `toValue` that takes `JCStatement` that also takes a second parameter for the target type?

Nvm - `tree.body` has type `JCTree`, so you do need a cast :-)

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

PR Review Comment: https://git.openjdk.org/babylon/pull/169#discussion_r1686221257


More information about the babylon-dev mailing list