[code-reflection] RFR: Null check only when selector expression of switch expression is of reference type

Paul Sandoz psandoz at openjdk.org
Tue Jun 4 20:01:08 UTC 2024


On Tue, 4 Jun 2024 18:56:30 GMT, Mourad Abbay <mabbay at openjdk.org> wrote:

> Generate lowered form of switch expression that check if the selector expression is null only when the selector expression has type reference.

We should also add a test

src/java.base/share/classes/java/lang/reflect/code/op/ExtendedOp.java line 826:

> 824:             Value selectorExpression = b.context().getValue(operands().get(0));
> 825: 
> 826:             if (!isSelectorOfTypePrimitive() && !haveNullCase()) {

I think you can replace `!(selectorExpression.type() instanceof PrimitiveType)` ?

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

PR Comment: https://git.openjdk.org/babylon/pull/112#issuecomment-2148317916
PR Review Comment: https://git.openjdk.org/babylon/pull/112#discussion_r1626537373


More information about the babylon-dev mailing list