<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! 
        We'll look into it.</font></font><br>
    <br>
    <div class="moz-cite-prefix">On 3/22/2023 2:13 PM, kishida naoki
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:CACLoY5s+_QhjjcXN67YgNTtTQQTPusZ5=LHLUvnxhNJyYxDAbw@mail.gmail.com">
      
      <div dir="ltr">
        <div>On running Nested Record+Switch code, java command throws
          error.</div>
        <div>condition is:</div>
        <div>  switch has 2 case clauses. 1 case + default has no
          problem.</div>
        <div>  The `Type` places 2nd position. `Product(Type type,
          String name)` has no problem.</div>
        <div>  sealed does not affect.<br>
        </div>
        <div><br>
        </div>
        <div>The code is below.<br>
        </div>
        <div><br>
        </div>
        <div>```</div>
        <div>public class PatternSample {<br>
            sealed interface Type {<br>
              record Bulk(int price) implements Type {}<br>
              record Packed(int price) implements Type {}<br>
            }<br>
          <br>
            record Product(String name, Type type) {}<br>
          <br>
            public static void main(String[] args) {<br>
              Product item = new Product("meat", new Type.Bulk(250));<br>
          <br>
              int total = switch(item) {<br>
                  case Product(var n, Type.Packed(int price))<br>
                           -> price;<br>
                  case Product(var n, Type.Bulk(int price))<br>
                           -> price * 2;<br>
                };<br>
              System.out.println(total);<br>
            }<br>
          }</div>
        <div>```<br>
        </div>
        <div><br>
        </div>
        <div>The error is below.<br>
        </div>
        <div><br>
        </div>
        <div>```</div>
        <div>>java --enable-preview PatternSample<br>
          Error: Unable to initialize main class PatternSample<br>
          Caused by: java.lang.VerifyError: Bad local variable type<br>
          Exception Details:<br>
            Location:<br>
              PatternSample.main([Ljava/lang/String;)V @155: iload<br>
            Reason:<br>
              Type top (current frame, locals[6]) is not assignable to
          integer<br>
            Current Frame:<br>
              bci: @155<br>
              flags: { }<br>
              locals: { '[Ljava/lang/String;', 'PatternSample$Product',
          top, 'PatternSample$Product', integer,
          'PatternSample$Product', top, top, top, 'java/lang/String',
          integer }<br>
              stack: { }<br>
            Bytecode:<br>
              0000000: bb00 0759 1209 bb00 0b59 1100 fab7 000d<br>
              0000010: b700 104c 2b59 b800 1357 4e03 3604 2d15<br>
              0000020: 04ba 0019 0000 ab00 0000 007c 0000 0001<br>
              0000030: 0000 0000 0000 0012 2d3a 0519 05b6 001d<br>
              0000040: 3a09 0336 0a19 0915 0aba 0021 0000 ab00<br>
              0000050: 0000 004d 0000 0002 ffff ffff 0000 004d<br>
              0000060: 0000 0000 0000 001a 1909 3a06 1905 b600<br>
              0000070: 223a 0b19 0bc1 0026 9900 1819 0bc0 0026<br>
              0000080: 3a07 1907 b600 2836 0b15 0b36 08a7 0009<br>
              0000090: 0436 0aa7 ffb2 1508 a700 0b15 0605 68a7<br>
              00000a0: 0004 083d b200 2c1c b600 32a7 0011 4ebb<br>
              00000b0: 0039 592d b600 3b2d b700 3ebf b1<br>
            Exception Handler Table:<br>
              bci [61, 64] => handler: 174<br>
              bci [110, 113] => handler: 174<br>
              bci [132, 135] => handler: 174<br>
            Stackmap Table:<br>
             
          full_frame(@30,{Object[#72],Object[#7],Top,Object[#7],Integer},{})<br>
              same_frame(@56)<br>
             
full_frame(@69,{Object[#72],Object[#7],Top,Object[#7],Integer,Object[#7],Top,Top,Top,Object[#74],Integer},{})<br>
              same_frame(@104)<br>
             
full_frame(@144,{Object[#72],Object[#7],Top,Object[#7],Integer,Object[#7],Object[#74],Top,Top,Object[#74],Integer},{})<br>
             
full_frame(@150,{Object[#72],Object[#7],Top,Object[#7],Integer,Object[#7],Object[#74],Object[#38],Integer,Object[#74],Integer},{})<br>
             
full_frame(@155,{Object[#72],Object[#7],Top,Object[#7],Integer,Object[#7],Top,Top,Top,Object[#74],Integer},{})<br>
             
          full_frame(@162,{Object[#72],Object[#7],Top,Object[#7],Integer},{})<br>
              full_frame(@163,{Object[#72],Object[#7]},{Integer})<br>
              full_frame(@174,{Object[#72]},{Object[#55]})<br>
              append_frame(@188,Object[#7],Integer)</div>
        <div>```<br>
        </div>
        <br>
        -- <br>
        <div class="gmail_signature" data-smartmail="gmail_signature">Naoki
          Kishida<br>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>