[code-reflection] RFR: Committing a Concatenation transformation to StringBuilder [v2]

Paul Sandoz psandoz at openjdk.org
Thu Jun 13 23:58:25 UTC 2024


On Thu, 13 Jun 2024 22:22:45 GMT, Ian Graves <igraves at openjdk.org> wrote:

>> A transformation that converts String Concatenation to StringBuilder for uses in lowering to Bytecode.
>
> Ian Graves has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Updates and refactorings

test/jdk/java/lang/reflect/code/TestStringConcatTransform.java line 125:

> 123:             Assert.assertEquals(transformed_model_interpreted, ssa_interpreted);
> 124:             Assert.assertEquals(ssa_interpreted, ssa_transformed_interpreted);
> 125:             Assert.assertEquals(ssa_transformed_interpreted, jvm_interpreted);

Won't the asserts errors get wrapped in RuntimeException? suggest you pull 'em out of. e.g.,

  String jvm_interpreted;
  try {
    jvm_interpreted = method.invoke(null, args);
  } catch (...) { ... }

  Assert....

test/jdk/java/lang/reflect/code/TestStringConcatTransform.java line 149:

> 147:                 .filter((method) -> method.isAnnotationPresent(CodeReflection.class))
> 148:                 .map(m -> new Object[]{m})
> 149:                 .toList();

I believe you can just create an array as in `.toArray(Object[][]:new)`

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

PR Review Comment: https://git.openjdk.org/babylon/pull/135#discussion_r1639057359
PR Review Comment: https://git.openjdk.org/babylon/pull/135#discussion_r1639057636


More information about the babylon-dev mailing list