<div dir="ltr">This is fixed in Java 20 build 27, 2022-12-09. Awesome! Thank you!</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 27, 2022 at 3:04 PM Brian Goetz <<a href="mailto:brian.goetz@oracle.com">brian.goetz@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

  
  <div>
    <font size="4"><font face="monospace">Thanks for the bug report! 
        This is the right place for bug reports like this.  <br>
        <br>
        I believe this is the same as a bug we're currently working on;
        the way we've specified exhaustiveness is almost, but not quite,
        right with respect to generics.  Stay tuned for an update.  <br>
      </font></font><br>
    <div>On 7/27/2022 2:26 PM, Clayton Wohl
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div>// The example given in Brian Goetz's article: <a href="https://www.infoq.com/articles/data-oriented-programming-java/" target="_blank">https://www.infoq.com/articles/data-oriented-programming-java/</a><br>
          sealed interface Opt<T> {<br>
              record Some<T>(T value) implements Opt<T> { }<br>
              record None<T>() implements Opt<T> { }<br>
          }<br>
          <br>
          // This works: Exhaustive switch without default case, but no
          record pattern<br>
          public static void thisWorks1(int value) {<br>
              Opt<String> optValue =
          doSomethingThatReturnsOpt(value);<br>
              switch (optValue) {<br>
                  case Opt.Some<String> some ->
          System.out.printf("got string: %s%n", some.value());<br>
                  case Opt.None<String> none ->
          System.out.println("got none");<br>
              };<br>
          }<br>
          <br>
          // This works: record pattern in a switch statement with a
          default case.<br>
          public static void thisWorks2(int value) {<br>
              Opt<String> optValue =
          doSomethingThatReturnsOpt(value);<br>
              switch (optValue) {<br>
                  case Opt.Some<String>(String v) ->
          System.out.printf("got string: %s%n", v);<br>
                  case Opt.None<String> none ->
          System.out.println("got none");<br>
                  default -> System.out.printf("default%n");<br>
              };<br>
          }<br>
          <br>
          // This does NOT compile: Exhaustive switch without default
          case + record pattern<br>
          public static void thisDoesNotWork(int value) {<br>
              Opt<String> optValue =
          doSomethingThatReturnsOpt(value);<br>
              switch (optValue) {<br>
                  case Opt.Some<String>(String v) ->
          System.out.printf("got string: %s%n", v);<br>
                  case Opt.None<String> none ->
          System.out.println("got none");<br>
              };<br>
          }<br>
        </div>
        <div><br>
        </div>
        <div>This is with the latest public JDK 19 build: <span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Menlo;font-size:11px">build
            19-ea+32-2220</span></div>
        <div><br>
        </div>
        I hope I'm posting to the correct list. If this list is for
        internal Java developers only, I'm sorry.</div>
    </blockquote>
    <br>
  </div>

</blockquote></div>