<div dir="ltr">A side note: you are showing the screenshots from IntelliJ IDEA. Being one of IntelliJ IDEA developers, I appreciate it. However, please note that error messages displayed by IntelliJ IDEA in the editor are not originating from javac. It's an independent implementation of the Java compiler frontend (except code generation) based on reading the specification and examining the reference implementation behavior. While we try our best to implement it correctly, it could differ in details from how the javac behaves, as there could be bugs in IntelliJ IDEA, or bugs in javac, or unclear places in the specification. I think that for discussions in this mailing list, showing messages from javac is more appropriate. If you prefer using IntelliJ, you may find them in the Build tool window when you actually build the project.<div><br></div><div>With best regards,</div><div>Tagir Valeev.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Feb 18, 2024 at 4:23 PM Charles <<a href="mailto:im741314@gmail.com">im741314@gmail.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 dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">Hi all</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">What I'm about to report below is <b>openjdk 17</b>. </div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">This doesn't compile</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><font color="#38761d">if (ex instanceof JedisException je<br> || (ex instanceof ExecutionException ee && ee.getCause() instanceof JedisException je)<br> ){<br></font></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><font color="#38761d"> ... blah blah</font></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><font color="#38761d">}</font></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">reason being the second je is already defined in the scope. </div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><img src="cid:ii_lsrfwx9h0" alt="image.png" width="562" height="58"><br></div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><font color="#000000"><br></font></div><div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">if you think about it. if ex is je, then, the second part won't trigger. And if the second part is reached, then ex is not je. Hence there is only going to be one statement mapped to je. </div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">no confusion here. I feel this should be allowed. </div><br></div><div><br></div><div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">Let's assume the above is the way it should be. I use different names for the second variable. </div><br></div><div><font color="#38761d"> if (ex instanceof JedisException je<br> || (ex instanceof ExecutionException ee && ee.getCause() instanceof JedisException second_je)<br> ) {<br> log.error(je);<br> log.error(second_je);<br> }</font><br></div><div><br></div><div><img src="cid:ii_lsrg2qdc1" alt="image.png" width="562" height="94"><br></div><div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">This still doesn't compile. </div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;color:rgb(0,0,0)">I would like to bring this issue up for discussion. </div><br></div><div><br></div><div><br></div><div><br></div><div dir="ltr"><span style="font-size:12.8px"><font color="#000000">and as always, have a great day <br></font></span></div><div dir="ltr"><b style="font-size:12.8px"><font color="#000000"><br></font></b></div><div dir="ltr"><b><font color="#000000">Best Regards<br></font></b><div><font face="arial, helvetica, sans-serif" color="#000000"><b>Charles</b></font></div><div><b><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#000000"><br></font></b></div><div><p style="margin:0cm 0cm 0.0001pt"><br></p></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</blockquote></div>