On Fri, 3 Nov 2023 16:26:49 GMT, Jan Lahoda <jlah...@openjdk.org> wrote:
> For code like: > > enum E {A {}, B {} } > Object o = E.A; > switch (o) { > case E.A -> System.err.println(o); > default -> System.err.println("default"); > } > > > The result is `default`, not `A`, due to incorrect classes being compared. > Thanks for @liach for noting the solution here: > https://github.com/openjdk/jdk/pull/16489#discussion_r1381411165 This pull request has now been integrated. Changeset: 541ff714 Author: Jan Lahoda <jlah...@openjdk.org> URL: https://git.openjdk.org/jdk/commit/541ff7149f9c6480535219ab06a2576f8399703a Stats: 122 lines in 3 files changed: 120 ins; 0 del; 2 mod 8318144: Match on enum constants with body compiles but fails with MatchException Reviewed-by: liach, vromero ------------- PR: https://git.openjdk.org/jdk/pull/16499