On Mon, 6 Nov 2023 07:34:38 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 > > Jan Lahoda has updated the pull request incrementally with one additional > commit since the last revision: > > Re-ordering tests as suggested. src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java line 397: > 395: > 396: try { > 397: if (!(value instanceof Enum<?> enumValue)) { this code seems to be here with the only purpose of casting `value` to `Enum<?>`, if this is the case shouldn't this intention be more explicit? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16499#discussion_r1383763927