<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <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 class="moz-cite-prefix">On 7/27/2022 2:26 PM, Clayton Wohl
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:CAO7pUDWpmsFo3VQFc=1F5cbucf0ikHNZVgx5FnBD-Ov96=bBRQ@mail.gmail.com">
      
      <div dir="ltr">
        <div>// The example given in Brian Goetz's article: <a href="https://www.infoq.com/articles/data-oriented-programming-java/" moz-do-not-send="true" class="moz-txt-link-freetext">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>
  </body>
</html>