[code-reflection] RFR: 8337162: Support primitives in patterns [v8]

Paul Sandoz psandoz at openjdk.org
Tue Oct 15 16:37:31 UTC 2024


On Tue, 15 Oct 2024 14:32:51 GMT, Mourad Abbay <mabbay at openjdk.org> wrote:

>> Support primitives in patterns
>
> Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Refactor to have one test method + add more test cases

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

> 3159:                 if (targetType instanceof PrimitiveType tt && target.type() instanceof PrimitiveType st) {
> 3160:                     patternWithPrimitive = true;
> 3161:                     if (List.of(CHAR, SHORT).contains(st)) {

This idiom is ok for tests, but generally it not very efficient. Just do `if (CHAR.equals(st) || SHORT.equals(st)) { ..` and prefix with a comment.

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

PR Review Comment: https://git.openjdk.org/babylon/pull/246#discussion_r1801550113


More information about the babylon-dev mailing list