[code-reflection] RFR: 8337156: Lowering of switch expressions that throw on no matching [v2]
Mourad Abbay
mabbay at openjdk.org
Sat Aug 3 07:54:44 UTC 2024
On Fri, 2 Aug 2024 19:57:21 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:
>> Actually... this code is about a lowering step... I think the best way would be to automatically insert a `default` label when generating the code model in `ReflectMethods`. At that point, as explained, the compiler knows which switches are "unconditional" and which are not. We could maybe reflect this piece of info in the model, but I think it's actually better to remove edge cases and just add the missing case.
>
> Yes, that seems a better approach given the knowledge the compiler has. For switch ops created manually we anyway cannot guarantee Java program behavior, same for other operations too.
>
> FWIW modeling of `if/else if/else` statements will always add an `else` if not explicitly present with the default behavior that yields nothing.
This will make testing easier, we simply need to test that the generated code model has default label that throws the right exception.
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/195#discussion_r1702603816
More information about the babylon-dev
mailing list