<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Ah, that's a shame, it would have been useful ;-)</p>
<p>--John<br>
</p>
<div class="moz-cite-prefix">On 06/12/2023 00:03, Scott Palmer
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:1F7B03D8-21D2-4EB1-846A-84CA2205DB1E@gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">I
was about to say the same. I wish it did, and applied the rule
that null never matches.</span>
<div><font color="#000000"><span style="caret-color: rgb(0, 0,
0);"><br>
</span></font>
<div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">You
could probably trick it with an ugly cast though. </div>
<div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><br>
</div>
<div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">
<div dir="ltr"><font face="Courier New">((Object)getScene())
instanceof Scene s</font></div>
<div dir="ltr">Maybe?</div>
<div dir="ltr"><br>
</div>
</div>
<div dir="ltr">
<div dir="ltr">Scott</div>
</div>
<div dir="ltr"><br>
<blockquote type="cite">On Dec 5, 2023, at 3:43 PM, Michael
Strauß <a class="moz-txt-link-rfc2396E" href="mailto:michaelstrau2@gmail.com"><michaelstrau2@gmail.com></a> wrote:<br>
<br>
</blockquote>
</div>
<blockquote type="cite">
<div dir="ltr"><span>Unfortunately, this doesn't work. The
Java language doesn't allow a</span><br>
<span>pattern to be the same type as the expression.</span><br>
<span></span><br>
<span></span><br>
<span>On Tue, Dec 5, 2023 at 1:27 PM John Hendrikx
<a class="moz-txt-link-rfc2396E" href="mailto:john.hendrikx@gmail.com"><john.hendrikx@gmail.com></a> wrote:</span><br>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>When this runs on the FX
thread it has to be safe, but it's not very nice.</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>These days you can do these
kind of null chain checks like this:</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span> if (getScene()
instanceof Scene s && s.getWindow() instanceof</span><br>
</blockquote>
<blockquote type="cite"><span>Window w &&
w.isShowing()) {</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span> }</span><br>
</blockquote>
<blockquote type="cite"><span></span><br>
</blockquote>
<blockquote type="cite"><span>--John</span><br>
</blockquote>
</div>
</blockquote>
</div>
</blockquote>
</body>
</html>