<div dir="auto"><div>It is odd that something like this is not a test-case already<br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 24, 2023, 17:59 Blaise B. <<a href="mailto:blaisebass@gmail.com">blaisebass@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello!<div><br></div><div>I could still reproduce the bug on JDK 21 EA (openjdk-21-ea+15_windows-x64_bin) with a slightly different code:</div><div><br></div><div>public class Main {<br> record Foo(Object first, Object second) {}<br> <br> public static void main(String[] args) { <br> Foo myfoo = new Foo(42, "millis");<br> <br> switch (myfoo) {<br> case Foo(Integer d, String s) -> System.out.println("got integer and string: " + d + ", " + s);<br> case Foo(Object fs, Object sc) -> System.out.println("values: " + fs + ", " + sc);<br> }<br> }<br>}<br></div><div><br></div><div><br></div><div>>javac --release 21 --enable-preview Main.java<br>Note: Main.java uses preview features of Java SE 21.<br>Note: Recompile with -Xlint:preview for details.<br><br><br>>java --enable-preview Main<br>Error: Unable to initialize main class Main<br>Caused by: java.lang.VerifyError: Bad local variable type<br>Exception Details:<br> Location:<br> Main.main([Ljava/lang/String;)V @192: aload<br> Reason:<br> Type top (current frame, locals[8]) is not assignable to reference type<br> Current Frame:<br> bci: @192<br> flags: { }<br> locals: { '[Ljava/lang/String;', 'Main$Foo', 'Main$Foo', integer, 'Main$Foo', top, top, 'java/lang/Object', top, 'java/lang/Object', integer }<br> stack: { 'java/io/PrintStream', 'java/lang/String' }<br> Bytecode:<br> 0000000: bb00 0759 05b8 0009 120f b700 114c 2b59<br> 0000010: b800 1457 4d03 3e2c 1dba 001a 0000 ab00<br> 0000020: 0000 0012 0000 0001 0000 0000 0000 001c<br> 0000030: bb00 1e59 0101 b700 20bf 2c3a 0419 04b6<br> 0000040: 0023 3a09 0336 0a19 0915 0aba 0027 0000<br> 0000050: aa00 0000 0000 0080 ffff ffff 0000 0001<br> 0000060: 0000 0054 0000 001c 0000 0054 1909 c000<br> 0000070: 0a3a 0519 04b6 0028 3a0b 190b c100 2b99<br> 0000080: 000d 190b c000 2b3a 06a7 0009 0436 0aa7<br> 0000090: ffb8 b200 2d19 0519 06ba 0033 0000 b600<br> 00000a0: 37a7 0034 1909 3a07 1907 c600 0e19 04b6<br> 00000b0: 0028 3a0b 190b 3a08 b200 2d19 07b8 003d<br> 00000c0: 1908 b800 3dba 0040 0000 b600 37a7 0008<br> 00000d0: 043e a7ff 45a7 0011 4dbb 001e 592c b600<br> 00000e0: 452c b700 20bf b1<br> Exception Handler Table:<br> bci [63, 66] => handler: 216<br> bci [117, 120] => handler: 216<br> bci [175, 178] => handler: 216<br> Stackmap Table:<br> append_frame(@23,Object[#7],Object[#7],Integer)<br> same_frame(@48)<br> same_frame(@58)<br> full_frame(@71,{Object[#80],Object[#7],Object[#7],Integer,Object[#7],Top,Top,Top,Top,Object[#2],Integer},{})<br> same_frame(@108)<br> full_frame(@140,{Object[#80],Object[#7],Object[#7],Integer,Object[#7],Object[#10],Top,Top,Top,Object[#2],Integer},{})<br> full_frame(@146,{Object[#80],Object[#7],Object[#7],Integer,Object[#7],Object[#10],Object[#43],Top,Top,Object[#2],Integer},{})<br> full_frame(@164,{Object[#80],Object[#7],Object[#7],Integer,Object[#7],Top,Top,Top,Top,Object[#2],Integer},{})<br> full_frame(@184,{Object[#80],Object[#7],Object[#7],Integer,Object[#7],Top,Top,Object[#2],Top,Object[#2],Integer},{})<br> full_frame(@208,{Object[#80],Object[#7],Object[#7],Integer,Object[#7],Top,Top,Top,Top,Object[#2],Integer},{})<br> full_frame(@213,{Object[#80],Object[#7]},{})<br> full_frame(@216,{Object[#80]},{Object[#67]})<br> append_frame(@230,Object[#7])<br></div></div>
</blockquote></div></div></div>