<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><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ß <michaelstrau2@gmail.com> 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 <john.hendrikx@gmail.com> 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></body></html>