[code-reflection] RFR: Fix modeling if statements

Maurizio Cimadamore mcimadamore at openjdk.org
Tue Jul 16 08:28:08 UTC 2024


On Mon, 15 Jul 2024 22:47:44 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:

> The else part of an if statement was incorrectly handled if it was not a block.
> 
> Additionally fixed `CodeReflectionTester` used in the language tests. It now accesses a code model of a method via getCodeModel rather than directly accessing the field, thereby this is not dependent on how the model is stored in the class file.

test/langtools/tools/javac/reflect/CodeReflectionTester.java line 66:

> 64:     static void check(Method method) throws ReflectiveOperationException {
> 65:         if (!method.isAnnotationPresent(CodeReflection.class)) return;
> 66:         String found = canonicalizeModel(method, method.getCodeModel().orElseThrow());

Was this even working after #162 (e.g. before this fix) ?

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

PR Review Comment: https://git.openjdk.org/babylon/pull/181#discussion_r1678973802


More information about the babylon-dev mailing list