[code-reflection] RFR: Fix modeling if statements

Paul Sandoz psandoz at openjdk.org
Tue Jul 16 15:37:07 UTC 2024


On Tue, 16 Jul 2024 08:25:25 GMT, Maurizio Cimadamore <mcimadamore 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) ?

Yes, i think we added this code early on before we added `Method::getCodeModel`

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

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


More information about the babylon-dev mailing list