<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">There doesn't seem to be a way to have a switch case pattern for multiple related patterns. Given that it works in an instanceof pattern I would think it might work in a switch pattern. But, maybe not. Anyway here's what I found.<div class=""><br class=""></div><div class="">Given:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class="">public interface MyFace {}</div><div class=""><br class=""></div><div class="">public record MyEye() implements MyFace {}</div><div class="">public record MyNose() implements MyFace {}</div><div class=""><br class=""></div><div class="">public void examine(Object face) {</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>switch (face) {</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>case MyEye eye, MyNose nose -> System.out.println("part of my face");</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>default -> System.out.println("Not part of my face");</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>}</div><div class="">}</div><div class=""><br class=""></div></blockquote><div class="">This produces: "illegal fall-through to a pattern".</div><div class=""><br class=""></div><div class="">However, this works with an instanceof pattern. E.g.</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><div class="">public void examine(Object face) {</div></div><div class=""><div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>if ((face instanceof MyEye eye) || (face instanceof MyNose nose)) {</div></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>System.out.println("part of my face");</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>}</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>else {<span class="Apple-tab-span" style="white-space: pre;"> </span></div><span class="Apple-tab-span" style="white-space:pre"> </span>System.out.println("Not part of my face");<div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>}</div><div class=""><div class="">}</div></div></blockquote><div class=""><br class=""></div><div class="">Of course, the instanceof test is not very useful as the bound variables "eye" or "nose" are only scoped to the immediate test (and not in the if block). So, this may not be a bug? Anyway, I thought I'd mention it. For the switch it would be useful to have common behavior for several related patterns without having to use a method to do it. The bound variables would be ignored (maybe via an upcoming wonderbar "_").</div><div class=""><br class=""></div><div class="">Cheers.</div><div class=""><br class=""></div><div class="">-Jordan</div><div class=""><br class=""></div></body></html>