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

Paul Sandoz psandoz at openjdk.org
Mon Oct 14 17:25:35 UTC 2024


On Mon, 14 Oct 2024 17:19:54 GMT, Mourad Abbay <mabbay at openjdk.org> wrote:

>> Support primitives in patterns
>
> Mourad Abbay has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Refactor
>  - Test int to float + assert the lowered model contains the right conversion method

test/jdk/java/lang/reflect/code/TestPrimitiveTypePatterns.java line 74:

> 72:     }
> 73: 
> 74:     static Op findOp(Body b, Predicate<Op> p) {

You can stream the code elements e.g.,

var actual = b.elements()
  .filter(ce -> ce instanceof InvokeOp)
  .map(op -> ((InvokeOp) op).invokeDescriptor())   // Use mapMulti instead of filter.map
  .findFirst().orElseThrow();
Assert.assertEquals(actual, expectedConversionMethod);

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

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


More information about the babylon-dev mailing list