RFR: 8318144: Match on enum constants with body compiles but fails with MatchException [v2]
Jan Lahoda
jlahoda at openjdk.org
Mon Nov 6 20:47:06 UTC 2023
On Mon, 6 Nov 2023 19:01:38 GMT, Vicente Romero <vromero at openjdk.org> wrote:
>> This method is also used in the `typeSwitch` (i.e. ordinary pattern matching switch, which may contain qualified enum constants intermixed with patterns), and so the `value` may be any object. If it is not an Enum, we can avoid the potential costly resolution.
>
> I see shouldn't we have a test that stresses this code? I mean that we are returning `false` for cases that are not enums?
I thought there's quite a few such tests, but turns out there's just a few (or maybe only one). So adding some more: [cbc9cb5](https://github.com/openjdk/jdk/pull/16499/commits/cbc9cb569b06c2f3d5e503519082c6243b51f9c8). Thanks!
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16499#discussion_r1383960309
More information about the compiler-dev
mailing list